Hi,
I'm using SES v4.52b, a nRF52832 module (BL652) and nRF5 SDK 16.0.0. I'm trying to build a generic SPI Read and Write functions with the following:
int8_t spi_reg_read(uint8_t cs, uint8_t reg_addr, uint8_t *reg_data, uint8_t length) { memset(reg_data, 0, length); //used to be 0xAA spi_xfer_done = false; uint8_t sizetx = 1; //sizeof(reg_addr); nrf_gpio_pin_clear(cs); APP_ERROR_CHECK(nrf_drv_spi_transfer(&spi, ®_addr, sizetx, reg_data, length)); while (!spi_xfer_done) { __WFE(); } nrf_gpio_pin_set(cs); NRF_LOG_INFO(" Received:"); NRF_LOG_HEXDUMP_INFO(reg_data, sizeof(®_data)); NRF_LOG_FLUSH(); }
The device I'm trying to control has two SPI slave buses and I'm using uint8_t cs to control which slave I'm talking to. I'm able to communicate once with the device and receive back the proper information in the register, but right after executing the nrf_gpio_pin_clear(cs); I get the LOCAL_ERR_CODE 0x00000018 in the expressions in SES. The second time I loop through the exact same register read, I don't get any value out (I don't have a scope available, but based on the err code I'm assuming that the nrf_gpio_pin_clear / set functions are failing after the first execution).
<info> app: Transfer completed. <info> app: Received: <info> app: 00 40 05 00 |.@..
Does anybody have any insight to why this err code would be happening?
Thanks!