This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to add uart debug support to BLE DFU

Hello,

I want to add uart debug support to the BLE DFU bootloader (nRF51822, S120, custom board). Therefor I increased the possible size of the bootloader (start 0x39800, size 0x6400). That works without any problems. Then I added the app_uart.c/app_uart.h module and implemented a uart_open() function:

void uartOpen(void){
uint32_t err_code = NRF_SUCCESS;
app_uart_buffers_t buffers;

	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_Baud38400
	};
         
buffers.rx_buf      = rx_buf;
buffers.rx_buf_size = sizeof (rx_buf);
buffers.tx_buf      = tx_buf;
buffers.tx_buf_size = sizeof (tx_buf);
err_code = app_uart_init(&comm_params, &buffers, uart_error_handle, APP_IRQ_PRIORITY_LOW, &m_uart_uid);
APP_ERROR_CHECK(err_code);}

But when I add a "printf("Bootloader started"); the bootloader hang up. The uartOpen() function seems to work. But it is hard to debug because without printf I can not get any feedback from the system.

What else do I need to add to the bootloader, to get a working uart interface?

Regards, BTProgrammer

Related