Hi all,
I am testing for FMC controller by NUCLEO_H743ZI2 and mbed studio. The version of mbed is latest(5.15)
When I using HAL function call HAL_SRAM_Read_8b() then below error info appeared. I also try many of class to fix thread, mutex, EventQueue e.g… But all failed.
++ MbedOS Fault Handler ++
FaultType: HardFault
Context:
R0 : 00000003
R1 : 00000018
R2 : 08007D18
R3 : 08008D29
R4 : 240025F4
R5 : 00000001
R6 : 60000080
R7 : 24002750
R8 : 24006A0C
R9 : FFFFFFFF
R10 : 24004C3C
R11 : 00000000
R12 : 080102E9
SP : 240069F0
LR : 08007CED
PC : 08007CEC
xPSR : 61000000
PSP : 240069D0
MSP : 2407FF88
CPUID: 411FC271
HFSR : 40000000
MMFSR: 00000000
BFSR : 00000082
UFSR : 00000000
DFSR : 0000000B
AFSR : 00000000
BFAR : 60000080
Mode : Thread
Priv : Privileged
Stack: PSP
– MbedOS Fault Handler –
++ MbedOS Error Info ++
Error Status: 0x80FF013D Code: 317 Module: 255
Error Message: Fault exception
Location: 0x8007CEC
Error Value: 0x240026C0
Current Thread: application_unnamed_thread Id: 0x24004DBC Entry: 0x8009D51 StackSize: 0x1000 StackMem: 0x24005A48 SP: 0x240069F0
For more info, visit: mbedos-error
– MbedOS Error Info –
Below is the code I used:
#include “mbed.h”
Serial debug0(PD_8, PD_9);
InterruptIn button(PC_13);
volatile bool Read_flag;
SRAM_HandleTypeDef hsram1;
static void MX_GPIO_Init(void);
static void MX_FMC_Init(void);
static void Error_Handler(void);uint8_t get_from_sram_3(uint32_t a);
uint32_t fsmc_addr;
uint8_t get_from_sram_3(uint32_t a)
{
uint8_t Sram_rx[0];fsmc_addr = 0x60000000 | a;
HAL_SRAM_Read_8b(&hsram1, (uint32_t*)(0x60000000|a), Sram_rx, 1);
return Sram_rx[0];
}void Get_8b()
{
debug0.printf(“Get_8b start\r\n”);get_from_sram_3(0x80);
get_from_sram_3(0x81);
get_from_sram_3(0x82);
get_from_sram_3(0x83);}
int main() {
MX_GPIO_Init();
MX_FMC_Init();debug0.baud(115200);
Read_flag = false;
button.rise(Get_8b);
debug0.printf(“Start\r\n”);
while(1){}
}
void MX_GPIO_Init()
{
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOF_CLK_ENABLE();
__HAL_RCC_GPIOH_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOE_CLK_ENABLE();
__HAL_RCC_GPIOD_CLK_ENABLE();
__HAL_RCC_GPIOG_CLK_ENABLE();
}/* FMC initialization function */
static void MX_FMC_Init(void)
{/* USER CODE BEGIN FMC_Init 0 */
/* USER CODE END FMC_Init 0 */
FMC_NORSRAM_TimingTypeDef Timing = {0};
/* USER CODE BEGIN FMC_Init 1 */
/* USER CODE END FMC_Init 1 */
/** Perform the SRAM1 memory initialization sequence
/
hsram1.Instance = FMC_NORSRAM_DEVICE;
hsram1.Extended = FMC_NORSRAM_EXTENDED_DEVICE;
/ hsram1.Init /
hsram1.Init.NSBank = FMC_NORSRAM_BANK1;
hsram1.Init.DataAddressMux = FMC_DATA_ADDRESS_MUX_DISABLE;
hsram1.Init.MemoryType = FMC_MEMORY_TYPE_SRAM;
hsram1.Init.MemoryDataWidth = FMC_NORSRAM_MEM_BUS_WIDTH_8;
hsram1.Init.BurstAccessMode = FMC_BURST_ACCESS_MODE_DISABLE;
hsram1.Init.WaitSignalPolarity = FMC_WAIT_SIGNAL_POLARITY_LOW;
hsram1.Init.WaitSignalActive = FMC_WAIT_TIMING_BEFORE_WS;
hsram1.Init.WriteOperation = FMC_WRITE_OPERATION_DISABLE;
hsram1.Init.WaitSignal = FMC_WAIT_SIGNAL_DISABLE;
hsram1.Init.ExtendedMode = FMC_EXTENDED_MODE_DISABLE;
hsram1.Init.AsynchronousWait = FMC_ASYNCHRONOUS_WAIT_DISABLE;
hsram1.Init.WriteBurst = FMC_WRITE_BURST_DISABLE;
hsram1.Init.ContinuousClock = FMC_CONTINUOUS_CLOCK_SYNC_ONLY;
hsram1.Init.WriteFifo = FMC_WRITE_FIFO_ENABLE;
hsram1.Init.PageSize = FMC_PAGE_SIZE_NONE;
/ Timing /
Timing.AddressSetupTime = 15;
Timing.AddressHoldTime = 15;
Timing.DataSetupTime = 255;
Timing.BusTurnAroundDuration = 15;
Timing.CLKDivision = 16;
Timing.DataLatency = 17;
Timing.AccessMode = FMC_ACCESS_MODE_A;
/ ExtTiming */if (HAL_SRAM_Init(&hsram1, &Timing, NULL) != HAL_OK)
{
Error_Handler( );
}/* USER CODE BEGIN FMC_Init 2 */
/* USER CODE END FMC_Init 2 */
}void Error_Handler()
{
debug0.printf(“Initail SRAM fail\r\n”);
Do anyone have any idea how to implement the function?