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

nRF51822 UART not work

Hi all My hardware is nRF51822 PCA0000 and PCA0001, I just want to compile/load any UART example to test my UART workable or not. So I have tried example project button_radio_exampleled_radio_example and uart_example, I got no signal on hypetrm with any example project. I set break point on Keil with any example project and got the same result, the processing hang on :

PCA0000 :


void simple_uart_put(uint8_t cr)
{
  NRF_UART0->TXD = (uint8_t)cr;

  while (NRF_UART0->EVENTS_TXDRDY!=1)   // HANG ON THIS LINE !!!!!!
  {
    // Wait for TXD data to be sent
  }

  NRF_UART0->EVENTS_TXDRDY=0;
}

PCA0001 :


uint8_t simple_uart_get(void)
{
  while (NRF_UART0->EVENTS_RXDRDY != 1)   // HANG ON THIS LINE !!!!!!
  {
    // Wait for RXD data to be received
  }
  
  NRF_UART0->EVENTS_RXDRDY = 0;
  return (uint8_t)NRF_UART0->RXD;
}

any idea ?

Parents
  • There shouldn't really be anything special needed to get this working. Which serial port are you connecting to, and which settings are you using? The examples use 38400 bps by default. Have you tried another terminal emulator?

    One thing I'd recommend you to verify is that the pinout is correct. This is easiest done by comparing the pinout given in the Evaluation Kit User Guide with the one actually used by your code. The different board revisions have the UART pins connected to different pins on the nRF51822, and if you use the wrong mapping, you will have trouble.

    Edit: Attached verified working hex for PCA10001. Please test it and see.

    uart_example_arm.hex

Reply
  • There shouldn't really be anything special needed to get this working. Which serial port are you connecting to, and which settings are you using? The examples use 38400 bps by default. Have you tried another terminal emulator?

    One thing I'd recommend you to verify is that the pinout is correct. This is easiest done by comparing the pinout given in the Evaluation Kit User Guide with the one actually used by your code. The different board revisions have the UART pins connected to different pins on the nRF51822, and if you use the wrong mapping, you will have trouble.

    Edit: Attached verified working hex for PCA10001. Please test it and see.

    uart_example_arm.hex

Children
  • I actually didn't mean the wrong serial port on the PC side, but the wrong pins for UART on the nRF51822 side. Can you please verify that as well? Also, the baud rate is usually set in the application you're using, i.e. putty or hyperterm, in addition to the port itself.

  • OK! The pin number of UART (print on back of the PCA0001 board) is : P0.08 RTS P0.09 TXD P0.10 CTS P0.11 RXD

    This is my pin define on PCA0001.h #define RX_PIN_NUMBER 11 #define TX_PIN_NUMBER 9 #define CTS_PIN_NUMBER 10 #define RTS_PIN_NUMBER 8

    Seems OK ?

  • I've attached a hex file that I just tested on my PCA10001 version 2.0 board. Can you please check whether it works correctly? You should also check that you haven't broken the solder bridges SB9-SB12, and that you have hardware flow control enabled in your terminal program.

  • I'd recommend you to verify again that the pin-out is correct. Depending on the hardware revision on your dongle, you may have to change the defines for the UART pins. The pinout is described in section 5.2.5 of the Development Kit user guide.

    I'd recommend to keep working on the uart_example until you are sure that you can both receive and send UART bytes to it. If you can receive text, but not write text, you should make sure that you have flow control enabled in your terminal software.

  • I'd recommend you to verify again that the pin-out is correct. Depending on the hardware revision on your dongle, you may have to change the defines for the UART pins. The pinout is described in section 5.2.5 of the Development Kit user guide.

    I'd recommend to keep working on the uart_example until you are sure that you can both receive and send UART bytes to it. If you can receive text, but not write text, you should make sure that you have flow control enabled in your terminal software.

Related