2020-03-19 03:43 AM
Hi,
We developed a custom board using the STM32F479NI MCU (using the Rev A).
We are using a SEGGER J-Link JTAG adapter to flash and debug our MCUs.
We are able to detect the MCU and to flash it using the J-Link softwares.
But when trying to debug the MCU, we immediately gets an SIGTRAP.
received signal SIGTRAP, Trace/breakpoint trap.
0xf3af4804 in ?? ()
When looking at the datasheet, the address 0xf3af4804 on this MCU is not pointing to the RAM nor the Flash but to the "Cortex M4 Internal peripherals".
When playing around, I had the same exact behavior (instant SIGTRAP when trying to debug) at other locations. I had it at 0x08000016 that is indeed in Flash.
I am now wondering what could cause that issue.
Could it be an hardware problem? or a JTAG issue? a linker problem maybe (even if it seems unlikely at this point) (the linker is the default one from STM32CubeMx)?
Please note that the code I uploaded to that board worked on the evaluation board (~only the pinout changed a little bit and mostly the JTAG from a usual 20 pin JTAG to a 4 pin one).
I will put the schematics in attachments.
Any help or tips is of course appreciated!
Thanks in advance,
AM.
Please note that not all components are populated.
2020-03-19 04:13 AM
Please note that not all components are populated.
And do we have to guess which ones are?
Set a breakpoint on Reset_Handler, and start stepping from there. Does it work? Where does it stop?
Try with a simple program. A really simple one. Toggle a single pin, using only the register interface. Only local variables.
void Reset_Handler() {
int i;
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOBEN;
RCC->AHB1ENR;
GPIOB->MODER = 1 << 4; // PB2 output
while(1) {
GPIOB->ODR ^= 1 << 2;
for(i = 0; i < 10000; i++)
__NOP();
}
}
Does it work when flashed and started standalone? Can you see PB2 toggling?
2020-03-19 07:00 AM
Hi and thank you for your very fast answer!
Well you don't have to guess, as you can see there is only a few components and it isn't extremely relevant to overwhelm with information on the first post I guess.
Thank you for your code, indeed I had an issue with the Reset_Handler.
When looking at the logs, I had the following issue :
The linker simply couldn't find my Reset_Handler, but it didn't came out as an error.
After fixing it, the MCU started correctly.
Thank you for pointing me in the right direction ;).
AM.