- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I'm trying to implement a CAN bus bootloader for the TC32x µC (only 1 bank of PFLASH).
As my code is executed from the same bank as the one I want to write to, I copied the erase/write functions to RAM. I also copied all my interruption vectors to RAM (including CAN bus interruption and timer) to avoid any access to the PFlash bank while writing in it.
Once I have switched to the RAM copies of my interruptions, everything still works fine. I can erase a block of PFlash without problem. But as soon as I try to write something, the behaviour of the µC is undefined. The CAN doesn't work anymore, the timer neither (the only use of the timer being making a LED blink to check proper operation).
After some undetermined amount of time, the normal behaviour resumes without any obvious reason.
Could someone give me a hint to what the problem could be or howI should try to investigate more deeply the issue?
Regards,
Benoit
Solved! Go to Solution.
- Labels:
-
AURIX
- Tags:
- bootloader
- pflash
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you for your answer.
I managed to solve my problem, which had nothing to do with writing in flash memory actually.
The problem was that I was using an STM timer for the main clock of my firmware. While writing in the flash memory, I had to disable interrupts. Hence the STM handler was not serviced at the right time.
As the interrupt is based on a compare and match mechanism, the interrupt was no longer generated (the STM value was higher than my compare value). So my application seemed to be frozen.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Questions:
1) When you write to the PFlash have you confirmed that the operation successfully completed (in other words was data written and you can view it in a memory window)?
2) Is the trap table for the CPU you are using to perform the flash operations are also located to RAM?
Perhaps you are getting a trap when you try to write to the PFlash.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you for your answer.
I managed to solve my problem, which had nothing to do with writing in flash memory actually.
The problem was that I was using an STM timer for the main clock of my firmware. While writing in the flash memory, I had to disable interrupts. Hence the STM handler was not serviced at the right time.
As the interrupt is based on a compare and match mechanism, the interrupt was no longer generated (the STM value was higher than my compare value). So my application seemed to be frozen.