stm32duino / Arduino_Core_STM32

STM32 core support for Arduino
https://github.com/stm32duino/Arduino_Core_STM32/wiki
Other
2.81k stars 967 forks source link

Clock does not start on STM32F373-Board #743

Closed michsens closed 4 years ago

michsens commented 4 years ago

Hello,

I developed a pcb with a STM32F373 in a LQFP-64 package. Programming is no big deal as long as I use TrueStudio. Clock configuration works well. Same for adc, dac, gpio input and output. Other modules I did not test. My aim was to see if the board itself works. It does.

The next step was to bring this board into the arduino environment. I defined the new board in the board file and created a folder with the variant, the ldscript, the PeripheralPins and PinNamesVAr files. I made I test with the well known Blink example. The compilation itself is successful, same with the upload.

But the controller does not start working. The 8MHz crystal does not start to operate what leads to a completely not working device.

I compared the libraries used by TrueStudio and arduino. I could not find anything suspicious. I also tried different versions of the stm32 cores (1.6.0, 1.6.1, 1.7.0) - no success.

What else can I observe to get the board working.

Regards

Robert.

fpistm commented 4 years ago

Hi @michsens this could comes from several reasons. Could you share your variant then I could have a look and helps also for your other issue #742

fpistm commented 4 years ago

Thanks but could you make an archive of the directory and attach it to this PR. Then I will have all files (PeripheralPins.c, PinNamesVar.h, ldscript.ld, variant.cpp, variant.h) and also boards.txt change you made.

fpistm commented 4 years ago

Could you also precise which core version you used ? (or maybe the git repository?) Host OS? Thanks in advance

michsens commented 4 years ago

Core Version 1.6.1

I also tried 1.7.0. But there was no difference.

michsens commented 4 years ago

Example_STM32F373R8.zip boards_Example.txt

fpistm commented 4 years ago

Thanks. This is more easy to review. Well they are several issue. The main one is the _estack definition in the linker script which I guess avoid your board to boot. Here all the fixes: https://github.com/fpistm/Arduino_Core_STM32/tree/Example_STM32F373R8

Example_STM32F373R8.zip

michsens commented 4 years ago

Thanks a lot for your help.

I have some question about the change in the PeripheralPins.c: Why do you call the SDADC by HAL_SD_MODULE_ENABLED? In the stm32 libraries it is defined as HAL_SDADC_MODULE_ENABLED https://github.com/fpistm/Arduino_Core_STM32/blob/Example_STM32F373R8/system/STM32F3xx/stm32f3xx_hal_conf_default.h ?

It also confuses me, why you activate a PULLUP for each channel. I would change the lines as follows:

from: {PB_0, SDADC1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF_NONE)}, // SDADC1_AIN6P

to: {PB_0, SDADC1,STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, SDADC1_AIN6P, 0)},

Would you agree? Do I missunderstand somethings?

fpistm commented 4 years ago

This is a mistake. The core doesn't manage SDADC. I have to update the script which generate the PeripheralPins.c to handle this properly.

fpistm commented 4 years ago

@michsens is it ok now? Your board starts properly?

michsens commented 4 years ago

I am home today. I check it tomorrow when I am in the lab. I give you some feedback then. Thanks until here.

michsens commented 4 years ago

Good Morning,

the change in the ldscript was the key. The oscillator starts properly and the LED blinks now. Many thanks fpistm.

fpistm commented 4 years ago

Welcome