Page 1 of 2

Continued issues with WeAct STM32F411

Posted: Wed Sep 16, 2020 12:10 am
by MGeo
I see this board presents challenges. With v1.9.0 core, Blink sketch and upload via J-Link SWD I have problems with board immediately losing the SWD connection and I am unable to debug. After that I am unable to connect to the board over SWD with or without hardware reset. I have to fully erase the chip via DFU to bring the board back to a working state. I am running the board bare, no bootloader of any sort.

I've reviewed this closed issue https://github.com/stm32duino/Arduino_C ... issues/876 my issues look similar.

Using the variant files from this comment https://github.com/stm32duino/Arduino_C ... -577418051 with a dedicated PILL_F411XX variant resolves the issue but I've not traced the root cause as of yet.

I realize this board unfortunately has a 25MHz oscillator on HSE rather than 8MHz. Are there any special instructions to use this board with v1.9.0 core?

Re: Continued issues with WeAct STM32F411

Posted: Wed Sep 16, 2020 1:13 am
by .rpv
I made a "black pill" with the F411CEU and duplicating the variant since it wasn't clear what HSE clock was the variant using... just overwriting the .id file and the clock config function (my board uses an 8MHz crystal) for what the stm32cubeide creates and I didn't have any problem so far with my blackpill version.

Re: Continued issues with WeAct STM32F411

Posted: Wed Sep 16, 2020 4:23 am
by fpiSTM
You can try to define HSE_VALUE to 25000000 thanks build_opt.h or hal_conf_extra.h

Re: Continued issues with WeAct STM32F411

Posted: Mon Oct 05, 2020 9:19 am
by ddano007
Hi, guys. I have BlackPill V3.0 STM32F411CEU6 board and want to use 16-pit PWM output.
When using pwmWrite() command I got
'pwmWrite' was not declared in this scope
message when compiling my sketch. Is there any way to have 16-bit PWM resolution for this board in Arduino IDE?
analogWriteResolution(16) + analogWrite() command still have only 12-bit resolution.
Thanks.

Re: Continued issues with WeAct STM32F411

Posted: Mon Oct 05, 2020 9:36 am
by fpiSTM
ddano007 wrote: Mon Oct 05, 2020 9:19 am 'pwmWrite' was not declared in this scope
I guess you used the STM32 core while your code call specific API from Roger's one. So update your code to use proper API against the core you used.

Re: Continued issues with WeAct STM32F411

Posted: Mon Oct 05, 2020 12:05 pm
by ddano007
fpiSTM wrote: Mon Oct 05, 2020 9:36 am I guess you used the STM32 core while your code call specific API from Roger's one. So update your code to use proper API against the core you used.
Yes, I`m using STM32 Cores. Is there any command for 16-bit PWM output?

Re: Continued issues with WeAct STM32F411

Posted: Mon Oct 05, 2020 12:30 pm
by fpiSTM
https://www.arduino.cc/reference/en/lan ... esolution/

Code: Select all

analogWriteResolution(16);
analogWrite(PYn, value);

Re: Continued issues with WeAct STM32F411

Posted: Mon Oct 05, 2020 12:51 pm
by GonzoG
ddano007 wrote: Mon Oct 05, 2020 9:19 am ...
analogWriteResolution(16) + analogWrite() command still have only 12-bit resolution.
...
I don't know why, by analogWrite resolution is limited to max ADC resolution.
wiring_analog.c

Code: Select all

void analogWriteResolution(int res)
{
  if ((res > 0) && (res <= 32)) {
    _writeResolution = res;
    if (_writeResolution > MAX_ADC_RESOLUTION) {
      _internalWriteResolution = MAX_ADC_RESOLUTION;
    } else {
      _internalWriteResolution = _writeResolution;
    }
  } else {
    Error_Handler();
  }
}
 

Re: Continued issues with WeAct STM32F411

Posted: Mon Oct 05, 2020 1:27 pm
by ddano007
fpiSTM wrote: Mon Oct 05, 2020 12:30 pm https://www.arduino.cc/reference/en/lan ... esolution/

Code: Select all

analogWriteResolution(16);
analogWrite(PYn, value);
Thanks for tip, but analogWriteResolution(16) doesn`t work, it "remap" 16-bit to 12-bit resolution on my board... :cry:
( I hope, I`m not wrong, that STM32F411 is by HW capable of 16-bit PWM output... )

Re: Continued issues with WeAct STM32F411

Posted: Mon Oct 05, 2020 2:07 pm
by fpiSTM
Else, You can use the HardwareTimer library:

https://github.com/stm32duino/wiki/wiki ... er-library