The thing with using the SDK is that early on it was clear that using the SDK is not working for this application with at this point pauses between bytes send over the SPI of 31µs.
The SDK function took way more time to do something else than actually sending the data.
In the first iteration of my own SPI send function I got that down to 21µs for the whole transfer of four bytes from chip-select down to chip-select up, with the SDK that would be ~150µs.
The next issue I ran into is that there are no standard CMSIS headers provided with functions like SysTick_Config() and when I added my own SysTick_Handler() I had to learn that the SDK SPI driver also is adding some RTOS files that they are depending upon.
I went along with the pins and clock driver. But only for the configuration, I am not driving the pins thru SDK functions.
Then I also checked out the "lpspi_dma_s32k144" example but it does not explain at all what is going on, it for the most part obfuscates the action with lots of unnecessary code. Not on purpose I presume but just because it is just a generic driver and is not on point of what is actually needed and what needs to be done.
Also I found the reference manual irritating since the way registers and bits in these registers are descriped does not match the actual syntax from the SDK.
I have been using quite a number of controllers so far but I had no prior experience with NXP controllers. At least not directly since the Teensy 4.1 also is using a NXP controller but the supplied SPI functions with DMA support just worked out of the box.
The S32K functions are in EVE_target.h line 1034ff and in EVE_target.c line 383ff. And of course the main.c is setup for only this project.
The rest of the files in /src are from my standard small demo for these displays and not part of the issue that the DMA is not looping thru the major loops.
Edit: forgot about one important detail, without the display attached the software will never get to the point of actually using the DMA to transfer a buffer since it is only used to refresh the frames.
Well, adding
EVE_init_dma();
EVE_dma_buffer_index = 32;
EVE_start_dma_transfer();
to main() compiles so it should behave the same, only the buffer is of course not filled with anything meaningfull.
Ok, I checked with the logic analyser and modified main() a little:
int main(void)
{
uint8_t led_delay = 0;
uint8_t display_delay = 0;
/* Initialize and configure clocks */
CLOCK_SYS_Init(g_clockManConfigsArr, CLOCK_MANAGER_CONFIG_CNT, g_clockManCallbacksArr, CLOCK_MANAGER_CALLBACK_CNT);
CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS0, g_pin_mux_InitConfigArr0); /* initialize pins */
SysTick_Init(48000000 / 200); /* configure and enable Systick for 5ms ticks */
EVE_init_spi();
// TFT_init();
EVE_init_dma();
EVE_dma_buffer_index = 32;
EVE_start_dma_transfer();
while(1)
{
if(system_tick)
{
system_tick = 0;
led_delay++;
if(led_delay > 49)
{
led_delay = 0;
LED0_PORT->PTOR = (1<<LED0_PIN);
}
// TFT_touch();
display_delay++;
if(display_delay > 3)
{
display_delay = 0;
// TFT_display();
}
}
}
}
And the result is four bytes on the SPI instead of the expected 127 for EVE_dma_buffer_index = 32.