So I've been playing around with some code example to make UART work (which I did eventually) using NRF SDK 5 (v17). However the last version of SES (8.22a) requires some tweaks in order to make it work. Like setting Library I/O setting to RTT (because otherwise stdout will throw errors) and also removing the limit of .rodata and .text sections (this is irrelevant I guess anyway). The code looks like this:
#include <stdbool.h> #include <stdint.h> #include <stdio.h> #include "app_uart.h" #include "app_error.h" #include "nrf_delay.h" #include "nrf.h" #include "bsp.h" #include "nrf_uart.h" #include "SEGGER_RTT.h" #define RX_SIZE 256 #define TX_SIZE 256 #define UART_HWFC APP_UART_FLOW_CONTROL_DISABLED // A simple error handler for uart if something goes wrong... void uart_err_handle(app_uart_evt_t * p) { printf("HERE: %d", p->evt_type); } int main(void) { //printf("Board Loaded"); bsp_board_init(BSP_INIT_LEDS); // initialize leds // uint32_t err_code; // a variable to hold the error value const app_uart_comm_params_t com_params = // struct to hold the uart configurations { RX_PIN_NUMBER, TX_PIN_NUMBER, RTS_PIN_NUMBER, CTS_PIN_NUMBER, UART_HWFC, // hardware flow control disabled false, // parity = none NRF_UART_BAUDRATE_115200 // set this baud rate for communication }; APP_UART_FIFO_INIT(&com_params, RX_SIZE, TX_SIZE, uart_err_handle, APP_IRQ_PRIORITY_LOWEST, err_code); APP_ERROR_CHECK(err_code); while(true) { uint8_t rx_ch; while (app_uart_get(&rx_ch) != NRF_SUCCESS); if (rx_ch == 't') { bsp_board_leds_on(); printf("Leds Turned On!!\r\n"); } else if (rx_ch == 'k') { bsp_board_leds_off(); printf("Leds Turned Off!!\r\n"); } } } /** @} */
As you can see it's just a basic example, but my question is this, IF I compile it with SES 5.42 (which I understand is the latest tested on v17) THEN everything works fine, but if I compile it with SES 8.22a (RTT option enabled) the function app_uart_get() never gets a result back... why is this ? and should I always use SES 5.42 ? are there any drawbacks ?