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.
Tool/software: Code Composer Studio
Dear Sir/Madam
I use sys/bios in TMS320F28075. I creat a timer instance form Device-sepcific timer module, I also creat a spi receive HWI instance from Device-specific Hwi module.
I don't want to timer interrupt disturb some atom code in SPI receive ISR, so I use GateHwi_enter(gateHwi0) and GateHwi_leave(gateHwi0, hwiGateKey) to include these code, however, it doesn't work, it can't block timer preemptation.
my current method is setting the masking option to MaskingOption_all in SPI receive hwi instance. so It runs well.
I was wondering why HWI gate can't protect the code.
Thanks!
Have a good day!
Frank
Hi Frank,
Try utilizing Hwi_disable() and Hwi_restore().
key = Hwi_disable(); /* Critical Code */ Hwi_restore(key);
Derrick
Hi Derrick:
Last time, I tried using Hwi_disable() and Hwi_enable(), I also does not work, Thanks!
Have a good day!
Frank
Frank,
Is your SPI interrupt service routine managed using the Hwi module?
Derrick
Hi Derrick.
Yes, SPI interrupt service is managed by HWI module. Thanks!
Have a good day!
Frank
Hi Derrick.
If I using Timer_start() and TImer_stop. It works well,Thanks!
Have a good day!
Frank
Frank,
The timer interrupt always uses the Hwi dispatcher as well (The Timer module automatically creates a Hwi instance for the timer interrupt). Given that, Hwi_disable() and Hwi_restore() should prevent your gated SPI code from being preempted.
Both the method of using the GateHwi_enter()/GateHwi_leave and Hwi_disable/Hwi_restore() are valid methods to solve your issue.
It appears you're experiencing unexpected behavior. How are you able to confirm your critical SPI code is being preempted by the Timer interrupt?
Could you share the version of SYSBIOS you're using?
Derrick
Derrick,
Thanks for your reply, test with two global variable, if timer preempte, one variable will plus one.
I checked again, I am not sure if this below is the cause.
In HWI module as below picture, the default value of the zero letency IER mask is 0x0. The timer use timer0, it correspond to INT1. So I can't use Hwi_disable(). I have not validated. I think that's may be the cause.
another picture from WIKI, that introduce the zero latency IER mask.
Thanks
Have a good day!
Frank
Frank,
Did you try wrapping your critical code with Hwi_disableIER()/restoreIER() calls to explicitly mask any zero-latency interrupts?
Derrick
Dear Derrick and ToddMullanix.
Thanks for your help, cause I am not in office these days, I have not validated this, So I have not update at moment. If I do this again, I will tell you results, Thank you very much.
Have a good day!
Frank
Frank,
Thanks. I'm going to mark this as resolved, but if you find an issue, just post a reply and it will be re-opened. If it gets locked, just start a new thread and add a link to this one.
Todd