This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SPI Slave problem with ANT NRF52832

Hi,

Raspberry (SPI Master) -> NRF52832 (SPI Slave)

The code below execute event_handler of SPI with NRF_DRV_SPIS_XFER_DONE type. But RX buffer is empty. All bytes are 0x00. I have verified the RXD->PTR address e all bytes in memory address are 00.

In logic analyzer SCK, CS and MOSI are ok. Only MISO (Slave out int NRF52832) return 00.

int main(void){
uint32_t err_code;
nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;

// Setup buttons and timer
utils_setup();

// Initialize LEDs
bsp_board_leds_init();

// Setup SoftDevice and events handler
err_code = softdevice_ant_evt_handler_set(ant_advanced_burst_event_handler); 
APP_ERROR_CHECK(err_code);

err_code = softdevice_handler_init(&clock_lf_cfg, NULL, 0, NULL);
APP_ERROR_CHECK(err_code);

err_code = ant_stack_static_config();
APP_ERROR_CHECK(err_code); 
spi_slave_example_init();NRF_LOG_INFO("Iniciado SPI\r\n");}

When I comment the lines "softdevice_ant_evt_handler_se", "softdevice_handler_init" and "ant_stack_static_config", SPI Slave operate fine, receiv and send data correct.

nRF5_SDK_12.2.0_f012efa

ANT_s212_nrf52_2.0.1

uint32_t spi_slave_example_init(void){  uint32_t           err_code;
nrf_drv_spis_config_t spi_slave_config = NRF_DRV_SPIS_DEFAULT_CONFIG;


spi_slave_config.miso_pin         = SPIS_MISO_PIN;
spi_slave_config.mosi_pin         = SPIS_MOSI_PIN;
spi_slave_config.sck_pin          = SPIS_SCK_PIN;
spi_slave_config.csn_pin          = SPIS_CSN_PIN;

	err_code = nrf_drv_spis_init(&spis, &spi_slave_config, spis_event_handler);

APP_ERROR_CHECK(err_code);

//Initialize buffers.
spi_slave_buffers_init(m_tx_buf, m_rx_buf, (uint16_t)TX_BUF_SIZE);

//Set buffers.
err_code = nrf_drv_spis_buffers_set(&spis, m_tx_buf, sizeof(m_tx_buf), m_rx_buf, sizeof(m_rx_buf));
APP_ERROR_CHECK(err_code);            

return NRF_SUCCESS;}

SDK_CONFIG:

SPIS_DEFAULT_CONFIG_IRQ_PRIORITY 3

SPIS_DEFAULT_MODE 0

SPIS_DEFAULT_BIT_ORDER 0

SPIS_DEFAULT_DEF 255

SPIS_DEFAULT_ORC 255

SPIS1_ENABLED 1

Some suggestions?

Thanks.

Related