This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

UART TASKS_SUSPEND and sending a break

Hello everybody,

I have a few questions about the built-in UART (UART0) in the nRF51822.

  1. I've noticed some registers that aren't fully documented in nrf51.h of the sdk. I'd like to know what TASKS_SUSPEND does. I'm also curious about SHORTS and if there's anything to know about POWER.

  2. The UART can interrupt on a break (en.wikipedia.org/.../transmitter, which is great for my application (two UARTs, one on each chip, go to sleep as often as possible and wake each other with a break). Does the UART have the capability to send a break using a simple command, or must I bit-bang a break of the pin by switching the crossbar to GPIO?

Thank you!

Parents
  • You can generate a break on UART0 by disconnecting the UART transmit from the GPIO pin and setting the GPIO pin low for the amount of time required to generate a break. You can then reconnect the UART transmit to your GPIO pin and begin your transmission.

    Here is how I did it for out project:

    
    // First disconnect the transmit pin from the UART by 
    // writing -1 to the PSELTXD register
    NRF_UART0->PSELTXD = 0xFFFFFFFF;
    
    // Set pin low to generate the necessary zeros on the line
    nrf_gpio_pin_write(TX_PIN_NUMBER, 0);
    
    // Delay for enough time to generate a break
    nrf_delay_us(100);
    
    // Reconnect the pin to the UART
    NRF_UART0->PSELTXD = TX_PIN_NUMBER;
    
    
    
Reply
  • You can generate a break on UART0 by disconnecting the UART transmit from the GPIO pin and setting the GPIO pin low for the amount of time required to generate a break. You can then reconnect the UART transmit to your GPIO pin and begin your transmission.

    Here is how I did it for out project:

    
    // First disconnect the transmit pin from the UART by 
    // writing -1 to the PSELTXD register
    NRF_UART0->PSELTXD = 0xFFFFFFFF;
    
    // Set pin low to generate the necessary zeros on the line
    nrf_gpio_pin_write(TX_PIN_NUMBER, 0);
    
    // Delay for enough time to generate a break
    nrf_delay_us(100);
    
    // Reconnect the pin to the UART
    NRF_UART0->PSELTXD = TX_PIN_NUMBER;
    
    
    
Children
No Data
Related