2021-04-26 07:24 AM
Hi,
When I leave my code to play for more than one hour I received the error HardFault_Handler(), I found in registers whats the last line executed before entering in the error function, below I put a picture of this part of the code.
Note: That error is random, don't have a specific moment time when happens.
Solved! Go to Solution.
2021-04-26 02:54 PM
Are you using dynamic allocation? (malloc() ,calloc()...).
If so, do your best to avoid that, as it's completely broken.
Better to declare an array and use it.
What I do when using big buffers but none at the same time, is making a big union with them.
So I can use any without eating up all my RAM.
2021-04-26 07:42 AM
Are you changing the SPI pointer at some point? An interrupt in that moment might cause trouble.
Can't help more without seeing any code.
2021-04-26 07:57 AM
Hi, Thanks for your answer.
No, I do not change de SPI pointer.
I'm using the demo code ST25R3911B-DISCO, I'm just using mifare_ul.c to read an EEPROM of a Tag.
2021-04-26 07:58 AM
Hi,
hpsi->pRxBuffPtr is at @0x20017fff which is the end of STM32L476 internal SRAM1 area. Access to next byte (@0x20018000) will cause a fault...
it looks like a HAL_SPI_TransmitReceive call with an incorrect/corrupted length parameter...
Rgds
BT
2021-04-26 08:04 AM
Is the buffer on the stack or heap?
Looks to be blowing the buffer's scope, add some better sanity checking in your code.
Watch for stack/heap overflow, or resource leaks within your implementation.
Remember callbacks are done under interrupt context, and there is likely a lot of non thread-safe code, or other things that are ill-considered.
2021-04-26 01:48 PM
Hi,
I resolve the problem increase de size of my buffer then received information by tag.
But now I had a new problem, below has a print of my new problem.
2021-04-26 01:58 PM
Hi,
hspi pointer seems to be corrupted (value 0x44444444: it looks like a buffer overflow has corrupted this pointer....).
I would recommend to check buffers size.
Rgds
BT
2021-04-26 02:54 PM
Are you using dynamic allocation? (malloc() ,calloc()...).
If so, do your best to avoid that, as it's completely broken.
Better to declare an array and use it.
What I do when using big buffers but none at the same time, is making a big union with them.
So I can use any without eating up all my RAM.