_lwsem_ problem with SPI slave ISR -MQX4.0, CW10.3, K20dx256

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

_lwsem_ problem with SPI slave ISR -MQX4.0, CW10.3, K20dx256

417 Views
cavebiker
Contributor V
  • Running a K20dx256 using CW10.3 / MQX4.0
  • I have a 32 bit SPI slave generating an interrupt when the RX buffer is not empty (RFDF bit in SPI2_SR)
  • Everything works fine until I _lwsem_post in the SPI ISR then _lwsem_wait in a task. When I do this I get a _Hard_Fault interrupt. No fun...
  • When I replace the ISR with a simple loop that reads the RFDF bit in SPI2_SR, the _lwsem_post & _lwsem_wait work fine. This makes me think it is interrupt related, but the interrupts work fine without the lw semaphore. ???
  • I built the 32Bit SPI slave driver with interrupts. This works great without the lwSem stuff.
  • Putting a breakpoint just before the _lwsem_wait gets rid of the problem. weird
  • Putting a _time_delay(100) just before the _lwsem_wait gets rid of the problem. ?
  • Putting a _time_delay(20) just before the _lwsem_wait does Not gets rid of the problem.

Has anyone seen this type of weirdness?

Any ideas would be great.

Cheers,

Tom

0 Kudos
1 Reply

239 Views
cavebiker
Contributor V

_lwevent_ works. So I'm over it, but I would still like to know what up with _lwsem_.

Cheers!

0 Kudos