Hello all,
I have code that works on CPU2. It interfaces SPI A & B.
There are some GPIO as well used as chip selects, transfer enable, etc. for devices connected to SPIs.
I moved that code to CLA on CPU2.
The problem is - now nothing is read back from SPI RX, it always returns zero.
I moved the code that manipulates the relevant GPIOs as well, set the ownership to of SPIs to CLA.
CLA is the secondary master (not DMA).
No interrupts are (were) used. The code waits until SpixRegs.SPISTS.bit.BUFFULL_FLAG is zero before writing.
Then waits until SpixRegs.SPISTS.bit.INT_FLAG is 1.
All writes/reads are of single 16 bit word synchronized by timer.
The number of iterations to test the INT_FLAG was limited to 15. After moving to CLA it started to timeout.
Increasing the limit to 200 did not solve the time out problem (this is arbitrary value, need to retest).
However, the data returned is zero.
SPI status register is zero after timeout. Is it possible that I am missing some other initialization?
Is it possible that CLA runs at clock different from CPU (hence, the timeout)?
Is there a need for EALLOW to access GPIO/SPI registers?
Any other thoughts/pointers are appreciated.
Thank you