The relevant parameters for this question are as follows:
1. IDE: S32 DS for ARM v 2.2 (Yes, I know this is old, but so is the product in question; we need to support the existing code)
2. Chip: S32K148
3. OS: Windows 11
4. System OS: Bare metal
Attempting to do any kind of SPI Master transfer in an ISR hangs, and usually the API that was interrupted is a blocking I/O (I2C or SPI) call.
On a blocking call (to LPSPI_DRV_MasterTransferBlocking() ), the call hangs because sysTick interrupts do not seem to be happening, so the MCU does not get a sense of elapsing time.
On a non-blocking call (LPSPI_DRV_MasterTransfer() followed by LPSPI_DRV_MasterGetTransferStatus(SPI1, &byte_remaining) ), byte_remaining stays at the original value. I have attempted to add a call to LPSPI_DRV_MasterAbortTransfer(SPI1) before calling LPSPI_DRV_MasterTransfer() for the async transfer, but the result is the same.
On a semi-related question, what triggers the SysTick_Handler() ? My intuition says it should be running all the time increasing the tick count every 1ms, but putting a break point in the body of it seems to hit only some time. Strangely, it is sometimes not hit even when a blocking SPI transfer is successful, which should be arming the system timer if it was unarmed before.
Another semi-related question is that in the S32 Cookbook example code for SPI, there are no use of the SDK provided APIs; the examples do all the register bit banging directly. Are there any examples that are closer to production worthy code, in that they at least call the NXP APIs instead of re-inventing the wheel?