I want to implement a ready line for SPI and I noticed nordic has similar code in your sdk: components/serialization/common/transport/ser_phy/ser_phy_spi_slave.c.
However the following comment concerns me: " //toggle - this should go high - but toggle is unsafe"
So I want to do a safe version and I do the following change:
In spi_slave_gpiote_init(), I change the following line
>> nrf_drv_gpiote_out_config_t config = GPIOTE_CONFIG_OUT_TASK_TOGGLE(true);
to
>> nrf_drv_gpiote_out_config_t config = GPIOTE_CONFIG_OUT_TASK_HIGH;
>> config.init_state = NRF_GPIOTE_INITIAL_VALUE_HIGH;
And I also change the lines in set_ready_line()
from:
>> //toggle - this should go high - but toggle is unsafe
>> uint32_t rdy_task = nrf_drv_gpiote_out_task_addr_get(m_spi_slave_raw_config.pin_rdy)
>> *(uint32_t *)rdy_task = 1;
to
>> nrf_gpio_pin_clear(m_spi_slave_raw_config.pin_rdy);
But it doesn't work at all. The ready line keeps high and never becomes low which indicates ready. I don't know what I do wrongly and what is supposed to be the safe way instead of toggle?