Announcements

Robots are revolutionizing our lives in many ways. Join our webinar to learn about Infineon’s broad portfolio of robot building blocks.
Click here to register.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

AURIX™ Forum Discussions

User21316
Level 2
Level 2
5 replies posted First like received 10 sign-ins

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

 

 

0 Likes
1 Solution

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. 

View solution in original post

0 Likes
2 Replies
cwunder
Employee
Employee
50 solutions authored 250 sign-ins 25 likes received

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.

0 Likes

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. 

0 Likes
This widget could not be displayed.