Hello,
i am trying to merge functions from the nRF52832, to test them and build up my application.
I started with the ble_app_uart example from the SDK_17.1.0 and added some GPIOs.
Now i'll import the esb_ptx example but i've some issues.
The initialization seem to be good and i can compile without any errors.
When calling the funktion nrf_esb_write_payload(&tx_payload), the UART just sends a "p" (of push).
After that the UART immediately sends "UART started" and I think the controller restarts.
Here the part of code:
int main(void)
{
//bool erase_bonds;
uint32_t err_code;
uint8_t base_addr_0[4] = {0xB0, 0xB0, 0xB0, 0xB0};
uint8_t base_addr_1[4] = {0xB0, 0xB0, 0xB0, 0xB0};
uint8_t addr_prefix[8] = {0xB0, 0xB0, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8 };
nrf_esb_config_t nrf_esb_config = NRF_ESB_DEFAULT_CONFIG;
nrf_esb_config.protocol = NRF_ESB_PROTOCOL_ESB_DPL;
nrf_esb_config.retransmit_delay = 600;
nrf_esb_config.bitrate = NRF_ESB_BITRATE_2MBPS;
nrf_esb_config.mode = NRF_ESB_MODE_PTX;
nrf_esb_config.tx_mode = NRF_ESB_TXMODE_AUTO;
nrf_esb_config.selective_auto_ack = true;
err_code = nrf_esb_init(&nrf_esb_config);
err_code = nrf_esb_set_base_address_0(base_addr_0);
err_code = nrf_esb_set_base_address_1(base_addr_1);
err_code = nrf_esb_set_prefixes(addr_prefix, NRF_ESB_PIPE_COUNT);
err_code = nrf_esb_set_rf_channel(23);
err_code = nrf_esb_set_bitrate(NRF_ESB_BITRATE_2MBPS);
NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
NRF_CLOCK->TASKS_HFCLKSTART = 1;
while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0);
// Initialize.
uart_init();
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();
nrf_gpio_cfg_output(15);
nrf_gpio_cfg_input(14,NRF_GPIO_PIN_PULLDOWN);
// Start execution.
printf("UART started\n");
NRF_LOG_INFO("Debug logging for UART over RTT started.");
advertising_start();
static nrf_esb_payload_t tx_payload = NRF_ESB_CREATE_PAYLOAD(0, 0x01, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00);
/*
======================================================================*/
while(1)
{
//idle_state_handle();
if(nrf_gpio_pin_read(14)) // Input
{
nrf_gpio_pin_write(15,1);
printf("push\n");
//tx_payload.noack = false;
nrf_esb_write_payload(&tx_payload);
//nrf_esb_start_tx();
nrf_delay_ms(1000);
}
else
{
nrf_gpio_pin_write(15,0);
}
}
}
I would be very happy about help.