Hello,
I'm attempting to use a high-limit reached event from the SAADC to trigger the clearing of a GPIO. My wish is to disable this GPIO with the lowest possible latency, avoiding the need for the CPU to manually clear the pin. However, my current technique isn't working. Below is the code I'm using to set up the PPI:
// Allocate a PPI channel
errCode = nrf_drv_ppi_channel_alloc( &mMotor.ppiChannel );
require_noerr( errCode, exit );
// Create task to clear GPIO
nrf_drv_gpiote_out_config_t config = GPIOTE_CONFIG_OUT_TASK_LOW;
errCode = nrf_drv_gpiote_out_init( mMotorConfig.enablePin, &config );
// Setup PPI channel so motor enable is immediately cleared when current limit is hit
errCode = nrf_drv_ppi_channel_assign( mMotor.ppiChannel, nrf_saadc_event_address_get( NRF_SAADC_EVENT_CH0_LIMITH ), nrf_drv_gpiote_out_task_addr_get( mMotorConfig.enablePin ) );
require_noerr( errCode, exit );
// Enable GPIO task
nrf_drv_gpiote_out_task_enable( mMotorConfig.enablePin );
// Enable PPI channel
errCode = nrf_drv_ppi_channel_enable( mMotor.ppiChannel );
I should also not that I've confirmed that the SAADC is being configured correctly and the high limit is being hit. Any help here would be appreciated. Thanks!