Hey max, all the code I’m running is from this repo. main.c and platformio.ini files are from there.
I made minimal progress, but not by changing anything. I can now successfully see the debugger start in main().
The code that is being executed right before the crash is line 140 of main.c. I’ve tried commenting out that particular line and it crashes again on the following line.
The call stack right before the crash:
Call stack at crash:
signal handler called>@0xfffffff9 (Unknown Source:0)
vector_table@0x00000000 (Unknown Source:0)
I did some digging around. Line 140 in the provided main.c is gpio_enable_ahb_aperture(). As defined in the libopencm3 docs, that function performs one thing: SYSCTL_GPIOHBCTL = 0xffffffff;
I looked around the MCU’s data sheet and found that memory address (http://www.ti.com/lit/ds/spms376e/spms376e.pdf, page 258):
It looks like only 5 bits need to be set to enable AHB aperture for all ports of the MCU, all other bits are reserved. That makes me wonder, should gpio_enable_ahb_aperture() really be doing this:
SYSCTL_GPIOHBCTL = 0x1F; ?
I might be chasing my tail here. Any clues?
Also, should I move this thread out of Troubleshooting?
EDIT: Whenever I step into the first line of main.c the debugger throws this message:
Error: memory read failed: 0x7