2018-03-30 02:03 AM
Hello! I'm using an STM32F769I-Discovery board. I'm trying to read/write a text file on the uSD card. Since I'm a beginner I started with the example in STM32Cube\Repository\STM32Cube_FW_F7_V1.9.0 - Copia\Projects\STM32F769I_EVAL\Applications\FatFs\FatFS_uSD.
I simply have inserted my uSD card in the CN5 connector and run the application. Problem is the code encounters an Error Handler with the message 'An MPU or Execute Never (XN) default memory map access violation has occurred on an instruction fetch'.
I debugged the code and I saw the problem is in function HAL_I2C_Mem_Read. I can't understand why..
How can I solve the problem?
Thanks
2018-03-30 03:03 AM
Go through the user manual of STM32F769I-Discovery board and confirm whether you need to make some jumper settings.
2018-03-30 05:03 AM
What toolset are you using, they build and download fine under Keil
There is an I2C attached co-processor monitoring some external pins, here the MicroSD's 'Card Detect' pin.
2018-03-30 05:08 AM
I checked the manual but I don't see any configuration to set.. I dug deeper in my problem and I found out the issue is related to I2C.
I'm using IAR Embedded Workbench.
There is an I2C attached co-processor monitoring some external pins, here the MicroSD's 'Card Detect' pin.
What is this for?
2018-03-30 05:10 AM
I'm using a STM32F769I Discovery board while the example code is supposed to be for the corresponding evaluation board.
2018-03-30 09:42 AM
Some of these boards are pin constrained due to SDRAM, LCD, etc and low bandwidth GPIO are moved to 'IO Expander' type device
For FatFS/SDCard prototype/templates on STM32F769I-DISCO look at
STM32Cube_FW_F7_V1.11.0\Projects\STM32F769I-Discovery\Applications\Display\LCD_PicturesFromSDCard
STM32Cube_FW_F7_V1.11.0\Projects\STM32F769I-Discovery\Examples\JPEG\JPEG_DecodingUsingFs_DMA
Which use the proper BSP source
STM32Cube_FW_F7_V1.11.0\Drivers\BSP\STM32F769I-Discovery\stm32f769i_discovery.c
STM32Cube_FW_F7_V1.11.0\Drivers\BSP\STM32F769I-Discovery\stm32f769i_discovery.h
STM32Cube_FW_F7_V1.11.0\Drivers\BSP\STM32F769I-Discovery\stm32f769i_discovery_sd.c
STM32Cube_FW_F7_V1.11.0\Drivers\BSP\STM32F769I-Discovery\stm32f769i_discovery_sd.h
2018-03-30 09:47 AM
Ok, so DISCO uses PI15
STM32Cube_FW_F7_V1.11.0\Drivers\BSP\STM32F769I-Discovery\stm32f769i_discovery.h
/**
* @brief SD-detect signal */ ♯ define SD_DETECT_PIN ((uint32_t)GPIO_PIN_15) ♯ define SD_DETECT_GPIO_PORT ((GPIO_TypeDef*)GPIOI) ♯ define SD_DETECT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOI_CLK_ENABLE() ♯ define SD_DETECT_GPIO_CLK_DISABLE() __HAL_RCC_GPIOI_CLK_DISABLE() ♯ define SD_DETECT_EXTI_IRQn EXTI15_10_IRQnEVAL uses IO_PIN_15
STM32Cube_FW_F7_V1.11.0\Drivers\BSP\STM32F769I_EVAL\stm32f769i_eval.h
♯ if defined(USE_IOEXPANDER)
♯ define XSDN_PIN IO_PIN_16 ♯ define MII_INT_PIN IO_PIN_13 ♯ define RSTI_PIN IO_PIN_11 ♯ define CAM_PLUG_PIN IO_PIN_12 ♯ define TS_INT_PIN IO_PIN_14 ♯ define AUDIO_INT_PIN IO_PIN_5 ♯ define OTG_FS1_OVER_CURRENT_PIN IO_PIN_6 ♯ define OTG_FS1_POWER_SWITCH_PIN IO_PIN_7 ♯ define OTG_FS2_OVER_CURRENT_PIN IO_PIN_8 ♯ define OTG_FS2_POWER_SWITCH_PIN IO_PIN_9 ♯ define SD1_DETECT_PIN IO_PIN_15 ♯ define SD2_DETECT_PIN IO_PIN_10 ♯ define SD_DETECT_PIN SD1_DETECT_PIN ♯ endif /* USE_IOEXPANDER */2018-03-30 10:13 PM
It's not that difficult to generate code for uSD card using STM32CubeMX. I will suggest you do that for the board you have.