This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28377S: How know if we are under interrupt context?

Part Number: TMS320F28377S

Hello,

I'm on a custom board using the F28377S. We can consider the use is the same than the ControlCard F28377D.

I'm using Code Composer Studio 7 and my application is issue from the IDDK kit exemple. (Control a Brushless motor)

For my application, I have an external memory (FRAM 25CL64)

I developed a driver which allow me to read/write From/To this external memory.

The application can have two contexts like done in the IDDK exemple:

- The groundloop called at the end of the main().

- An ISR function which is called on PWM interrupt to manage Motor control.

I can have another high prior interrupt to manage a Resolver Feedback.

Currently, my driver is not protected if a Write memory is executed from the groundtask and interrupted by ISR, in which a Write access is also done.

My current code will never have this case. But for the futur (I don't know if it will be always me or not will maintain this soft) I would like detect if I call my Memory write routine from the ISR context.

Because if it is the case, maybe a previous write (in ground loop) was interrupted during the SPI protocol..

So I think a solution:

My Memory Write routine should detect the current context (GroundLoop / ISR) then if ISR context, generate a specific error message Log...

So my question is:

Have I a way to easily know if I am on the ground Loop or from an ISR context?

Thank