Hi,
I am working on the ble_app_uart which should forward data to the SPI port of the nRF52832.
It all works fine while the J-Link is connected. If I want to run my application without attached debugger it does not work. It gets stuck in SPI transfer while waiting for the Slave to pull the busy pin to low in a while loop.
I attached a logic analyser and the SPI looks like in debugging mode, till the nRF52832 waits for the slave to respond.
But why does the Slave not respond to the transmitted configuration data? If I run the nRF52832 without J-Link?
I read many posts in the devzone but I dont know where to start.
I am working with SES and nRF5_SDK_15.2.0.
I adjusted the project configuration in SES to both Debug and Release to the same:
Code > Code Generation > Optimization Level > None
Code > Code Generation > Debugging Level > Level 3
Are there any other things to consider? Power mode? CMSIS / sdk_config.h settings?
Code Snippet:
int main(void)
{
bool erase_bonds;
// Initialize.
uart_init();
//SPI init
nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;
spi_config.mode = NRF_DRV_SPI_MODE_0;
spi_config.frequency = NRF_DRV_SPI_FREQ_1M;
spi_config.ss_pin = SPI_SS_PIN;
spi_config.miso_pin = SPI_MISO_PIN;
spi_config.mosi_pin = SPI_MOSI_PIN;
spi_config.sck_pin = SPI_SCK_PIN;
//spi_config.irq_priority = 0;
APP_ERROR_CHECK(nrf_drv_spi_init(&spi, &spi_config, spi_event_handler, NULL));
//Slave reset pin
nrf_gpio_cfg_output(RST_PIN);
nrf_gpio_pin_set(RST_PIN);
//Slave busy pin
nrf_gpio_cfg_input(BUSY_PIN, NRF_GPIO_PIN_NOPULL);
//Original code...
log_init();
timers_init();
buttons_leds_init(&erase_bonds);
power_management_init();
ble_stack_init();
gap_params_init();
gatt_init();
services_init();
advertising_init();
conn_params_init();
// Start execution.
printf("UART started.\r\n");
NRF_LOG_INFO("Debug logging for UART over RTT started.");
/
printf("SPI Test...\r\n");
if (SLAVE_Init() != 0) {
} else {
SLAVE_SendData();
SLAVE_Sleep();
}
printf("Start advertising\r\n");
advertising_start();
// Enter main loop.
for (;;)
{
//If flag is set from nus_data_handler, forward it...
if(start_spi_tx_flag)
{
printf("SPI Test...\r\n");
if (SLAVE_Init() != 0) {
} else {
SLAVE_SendData();
SLAVE_Sleep();
}
start_spi_tx_flag = false;
}
idle_state_handle();
}
}
Best regards

