cancel
Showing results for 
Search instead for 
Did you mean: 

Cubemx sdcard problem

mparker19919
Associate
Posted on August 31, 2016 at 13:12

I am creating a project using Nucleo F401RE and cubemx and visualgdb.

I've got a problem where there seems to be a clash between eeprom on spi and a 4bit sdio sdcard. I've got them working independently and together but on their own.

When in the same project if I add buttons (interrupts) and leds and an lcd (outputs) they still work but if I try adding any of adc/timer/rtc/i2c/usart the problem occurs.

I can either have:

eeprom read/write and just sdcard erase.

or

No eeprom functions and sdcard read/write/erase.

If I try having both the project always fails in sd mount returning a wrong number of volumes, including if I have sdcard function in the project but not used, i.e. on a button press.

I know it�s not the heap/stack, hardware or shared variables and I�ve tried changing the order of inits.

Does anyone know of any possible bugs that may have happened in cubemx generation? Any help would be much appreciated.

Marcus

#f_mount-sdcard #nucleo #st32cubemx
3 REPLIES 3
christoph2399
Associate II
Posted on August 31, 2016 at 13:49

did you try the latest HAL-library from the STM32CubeMX?

maybe you did not initialize the pins correctly.

for instance when you init the uart with the function MX_USART3_UART_Init() or HAL_UART_Init() the stm-library calls the function HAL_UART_MspInit() which is responsible to set the gpio's right

all peripherals can be mapped on different pins, some pins share more then one feature. e.g. the same pin could be configured as uart4_tx usart3_tx spi3_clock ... and many more.

if you init for instance uart3 on a stm32f205 and map the tx-pin to PC10 you can not use this pin for clock on the spi3 peripheral. 

i highly recommend to use the STM32CubeMX which is helping you and also setting up the project ready to compile :)
mparker19919
Associate
Posted on August 31, 2016 at 17:22

I selected different pins in cubemx and can see that there are no shared pins in the inits or the stm32f4xx_hal_msp file.

christoph2399
Associate II
Posted on August 31, 2016 at 21:31

try to ''enable full assert'' in the settings in stm32cubemx, or just

 #define USE_FULL_ASSERT    1  in .\Inc\stm32f2xx_hal_conf.h

wrong paramets or initialisation errors will result in function call

void assert_failed(uint8_t* file, uint32_t line) in main.c

just add a while(1) for a dead-loop an then you can debug from there