I'm struggling to get SPI working on the S32K148EVB-Q176 eval board.
Matlab R2020a, Mode-Based Design Toolbox 4.2.4
I have an external SPI peripheral that I'm attempting to communicate with using SPI1.
I have modified the SPI Master example to match the pinout and configuration of the S32K148EVB-Q176 and have added a couple additional GPIO LED blink blocks from other examples to ensure that the model is executing as intended.
The blue LED (constant blinking) and red LED (toggle based in interrupt from button) are both working correctly (so the model is executing and interrupts are working), but the green LED (SPI transfer END interrupt) never comes on. I don't see any level changes on any of the clock, data, or chip select pins on an oscilloscope. CS is held high, CLK is held low, MOSI (PTA27) is held high, MISO (PTA29) is low. If I remove the SPI blocks from the model, all of these pins remain low during execution.
So it seems as though the SPI1 instance is being initialized successfully, but data transfers are not occurring.
I'm not sure what I might be missing. Any assistance in getting the data transfers to occur would be appreciated. Model is attached.
As it turns out, the SPI on the S32K142 only works when I have the "Transfer Size" set to 8 bits in the LPSPI Config block. If I set "Transfer Size" to 16 it doesn't seem to work.
Is there something else I need to do to get 16 bit SPI working?
Actually it looks like if I set "Frame Size" to 8 bits and then feed the transmit block a vector of two uint8_t values with "Continuous Transfer" enabled, it sends the two 8 bit values as a single 16 bit transmission, which I think will work for what I need.
What then is the purpose of the "Transfer Size" or "Frame Size" parameter in the SPI configuration block? I think I must be misunderstanding what that parameter is for.
As a follow up on this, I was able to get SPI working on an S32K142. I'm still trying to understand what I might be doing incorrectly on the S32K148.