AnsweredAssumed Answered

HAL-based FSMC setup code causing Hard Fault: Periph Library doesn't!

Question asked by macfarlane.ken on Jul 27, 2016
Latest reply on Jul 28, 2016 by waclawek.jan
I have code that drives the FSMC & in turn an SSD1305 LCD controller. Trouble is, in order to integrate it with the rest of my application, it needs to use the HAL, as all of my SPI, I2C etc is HAL-based.

I've written a HAL-based FSMC setup equivalent & it hard faults on the 2nd access to the LCD if the FSMC setup code is called. If its not called, it loops around trying to access the LCD forever, which it can't quite do, as, because the FSMC isn't setup, the control lines wont actually do anything.

I've added the Hard Fault handler that I found in Joseph Yiu's M3 book (I don't think the M4 will be much different, but I don't have that version), and relating the Link Register [R14] contents,  0x1840 to the .map file, the HAL GPIO routines seem to be there, on both sides of that address by a few hundred bytes, but that depends upon me correctly interpreting the sections at the end of the file, of which there are many e.g.  .debug_info,  .debug_arrange, frame etc etc. (I'm out of my depth trying to figure out what the registers are telling me until I do some more googling!). Can anybody more expert than I, see anything obvious with this HAL code?

FSMCTest built on Jul 27 2016 at 21:36:52
FSMC_NORSRAM_Init:: OK.
FSMC_NORSRAM_Timing_Init:: OK.
[Hard fault handler - all numbers in hex]
R0 = 16a9000
R1 = 0
R2 = 3fff000
R3 = 1400000
R12 = 985f
LR [R14] = 1840  subroutine call return address
PC [R15] = 0  program counter
PSR = 0
BFAR = e000ed38
CFSR = 400
HFSR = 40000000
DFSR = b
AFSR = 0
SCB_SHCSR = 0
Info : dropped 'gdb' connection

Attachments

Outcomes