Hi! Im doing a SPI transaction using EGU and PPI.
Software triggers the EGU, and PPI_CHANNEL_1 uses this event to start the SPIM transaction and set the CS pin low.
PPI_CHANNEL_2 uses the SPIM_EVENTS_END to set the CS pin high again, and also trigger the SPIM_TASKS_STOP to lower the current consumption.
However, the SPIM does not stop when using the PPI.
By attaching an interrupt to another EGU channel, and triggering the EGU channel by PPI instead, I am able to stop the SPIM. But this also seems to only be working if I reset the EVENT_END event first.
PPI_config that start the SPI Transaction:
static const ppi_channel_config_t ms5803_egu_start_ppi_config = {
.event_address = &MS5803_EGU->EVENTS_TRIGGERED[MS5803_RESET_EGU_CHANNEL],
.task0_address = &NRF_GPIOTE->TASKS_CLR[MS5803_CS_GPIOTE_CHANNEL],
.task1_address = &MS5803_SPIM->TASKS_START,
};PPI_config that stops the SPI Transaction: Note that the SPIM does not stop with the PPI, therefore the line is commented out.
static const ppi_channel_config_t ms5803_end_ppi_config = {
.event_address = &MS5803_SPIM->EVENTS_END,
.task0_address = &NRF_GPIOTE->TASKS_SET[MS5803_CS_GPIOTE_CHANNEL],
.task1_address = &MS5803_EGU->TASKS_TRIGGER[4],
//.task1_address = &MS5803_SPIM->TASKS_STOP,
};EGU interrupt that actually stops the SPIM:
static void ms5803_spim_stop()
{
spim_trigger(MS5803_SPIM, SPIM_TASK_STOP);
spim_disable(MS5803_SPIM);
}
From further testing it seems that I am able to stop the SPIM by triggering the STOP_TASK through the debugger, and then triggering the START_TASK through the debugger.