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

uart example for nRF6700 (nRFgo starter kit) didn't work

I installed nrfgostudio_win-64_1.15.1_installer, nrfgo_sdk_2.3.0_setup and nrfprobe_v2_0_0_7252 to test nRFgo starter kit(nRF6700). I tried to test uart on nRF24LE1D. but the uart example didn't work. I don't see "Hello World!" from P0.5(TXD).

Did I miss something? How to do fix this bug?

thank you.


#include <stdio.h> #include "nrf24le1.h" #include "hal_uart.h" #include "hal_clk.h"

// Cusomization of low level stdio function. Used by for example printf(). #ifdef ICC8051 int putchar(int c) #else /presume C51 or other accepting compilator/ char putchar(char c) #endif { hal_uart_putchar(c); return c; }

// Cusomization of low level stdio function. Used by for example gets(). #ifdef ICC8051 int getchar(void) #else /presume C51 or other accepting compilator/ char getchar(void) #endif { return hal_uart_getchar(); }

// Repeated putchar to print a string void putstring(char *s) { while(*s != 0) putchar(*s++); }

void main(void) { // Configure TXD pin as output. // P0.5, P0.3 and P1.0 are configured as outputs to make the example run on // either 24-pin, 32-pin or 48-pin nRF24LE1 variants. P0DIR = 0xD7; P1DIR = 0xFE;

// Initializes the UART hal_uart_init(UART_BAUD_9K6);

// Wait for XOSC to start to ensure proper UART baudrate while(hal_clk_get_16m_source() != HAL_CLK_XOSC16M) {}

// Enable global interrupts EA = 1;

// Print "Hello World" at start-up putstring("\r\nHello World!\r\n");

for(;;) { // If any characters received if( hal_uart_chars_available() ) { P3 = 0x11; // Echo received characters putchar(getchar()); } } }

  • Have you made sure to connect the appropriate GPIO (as defined in chapter 17 of the PS) to P15 on the motherboard, and turned on S11? This is described in more detail in section 2.9 of the nRFgo Starter Kit User Guide.

    Also, if you use the 24-pin or the 48-pin variant, there is overlap between the JTAG debug interface and the UART, meaning that you will not be able to use both at the same time.

  • Thanks, I found problem, I use 24-pin package, so there is no P0.7 or P1. I had to use just "P0DIR = 0x5F;"

    void main(void) { // Configure TXD pin as output. // P0.5, P0.3 and P1.0 are configured as outputs to make the example run on // either 24-pin, 32-pin or 48-pin nRF24LE1 variants. P0DIR = 0x5F; <== don't use P0.7 as input //P1DIR = 0xFE; <== commented out

    // Initializes the UART hal_uart_init(UART_BAUD_9K6);

    // Wait for XOSC to start to ensure proper UART baudrate while(hal_clk_get_16m_source() != HAL_CLK_XOSC16M) {}

    // Enable global interrupts EA = 1;

    // Print "Hello World" at start-up putstring("\r\nHello World!\r\n");

    for(;;) { // If any characters received if( hal_uart_chars_available() ) { //P3 = 0x11; <== commented out // Echo received characters putchar(getchar()); } } }

  • Great that you found the solution! I accepted your answer, to clear up the discussion. You could also have done this yourself. :-)

  • Can you please tell me how did you set everything to see the print?

    Thank you

Related