Hi All!
I use SPI with ss_pin = NRF_DRV_SPI_PIN_NOT_USED. but seems it doesn not work properly.
in the file nrfx_spi.c , the following code exist to init ss_pin during initialization :
if (p_config->ss_pin != NRFX_SPIM_PIN_NOT_USED) { if (p_config->ss_active_high) { nrf_gpio_pin_clear(p_config->ss_pin); } else { nrf_gpio_pin_set(p_config->ss_pin); } nrf_gpio_cfg_output(p_config->ss_pin); #if NRFX_CHECK(NRFX_SPIM_EXTENDED_ENABLED) if (p_config->use_hw_ss) { m_cb[p_instance->drv_inst_idx].use_hw_ss = p_config->use_hw_ss; nrf_spim_csn_configure(p_spim, p_config->ss_pin, (p_config->ss_active_high == true ? NRF_SPIM_CSN_POL_HIGH : NRF_SPIM_CSN_POL_LOW), p_config->ss_duration); } #endif m_cb[p_instance->drv_inst_idx].ss_pin = p_config->ss_pin; m_cb[p_instance->drv_inst_idx].ss_active_high = p_config->ss_active_high; }
according to this CODE , If ss_pin == NRFX_SPIM_PIN_NOT_USED , m_cb[p_instance->drv_inst_idx].ss_pin] remains ZERO (uninit) and then, in the function nrfx_spim_xfer(...) , the CODE:
if (p_cb->ss_pin != NRFX_SPIM_PIN_NOT_USED) { #if NRFX_CHECK(NRFX_SPIM_EXTENDED_ENABLED) if (!p_cb->use_hw_ss) #endif { if (p_cb->ss_active_high) { nrf_gpio_pin_set(p_cb->ss_pin); } else { nrf_gpio_pin_clear(p_cb->ss_pin); } } }
will always be executed with wrong ss_pin value (zero ?).
Please, explain this behavior.
thanks.