I have an application programed on the nRF 52DK (PCA10040). Its a UART communication to a distance sensor. The Problem is, that I cant send anything from the uC to the Sensor.
With the debugger I see that it will never get into tx_done_event. So the tx_buffer_length will always be 1.
But when I start Termite on my computer, then is everything working. Termite has to be open just once and then it will work. When I turn off the supply and close Termite and than again supply then it will not work.
And also interesting is, when I start Termite, then the tx_buffer_length will be 0 and then I will get into tx_done_event.
How is that possible?
What can Termite set on my nRF52DK to clear the tx_buffer_length?
UPDATE
Checked TX and RX with the logic analyzer when I start Termite. And nothing happens.
Whats about the micro usb plug on the development Kit. Maybe something changes from the micro usb to rs232 converter when I start Termite?
CODE
static void uart_init(void)
{
uint32_t err_code;
const app_uart_comm_params_t comm_params =
{
RX_PIN_NUMBER,
TX_PIN_NUMBER,
RTS_PIN_NUMBER,
CTS_PIN_NUMBER,
APP_UART_FLOW_CONTROL_DISABLED,
false,
UART_BAUDRATE_BAUDRATE_Baud19200
};
APP_UART_FIFO_INIT( &comm_params,
UART_RX_BUF_SIZE,
UART_TX_BUF_SIZE,
uart_event_handle,
APP_IRQ_PRIORITY_LOW,
err_code);
APP_ERROR_CHECK(err_code);
}
#define UART0_ENABLED 1
#if (UART0_ENABLED == 1)
#define UART0_CONFIG_HWFC NRF_UART_HWFC_DISABLED
#define UART0_CONFIG_PARITY NRF_UART_PARITY_EXCLUDED
#define UART0_CONFIG_BAUDRATE NRF_UART_BAUDRATE_19200
#define UART0_CONFIG_PSEL_TXD 6
#define UART0_CONFIG_PSEL_RXD 8
#define UART0_CONFIG_PSEL_CTS 7
#define UART0_CONFIG_PSEL_RTS 5
#define UART0_CONFIG_IRQ_PRIORITY APP_IRQ_PRIORITY_LOW
#ifdef NRF52
#define UART0_CONFIG_USE_EASY_DMA false
//Compile time flag
#define UART_EASY_DMA_SUPPORT 1
#define UART_LEGACY_SUPPORT 1
#endif //NRF52
#endif