This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2530 configuring UART by disabling Flowcontrol

Other Parts Discussed in Thread: CC2530

Hi all,

I will use UART with DMA  on P0.2, P0.3 by disabling Flowcontrol. On P0.5 I connect a LED(with driver).
I set the uartConfig.flowControl          = FALSE; After Reading LED is ON. So in debug Mode I find this instructions
in the uint16 HalUARTReadDMA(uint8 *buf, uint16 len)   PxOUT &= ~HAL_UART_Px_RTS;  // Re-enable the flow on any read.

and this one PxOUT |= HAL_UART_Px_RTS;  // Disable Rx flow in the void HalUARTPollDMA(void)

that mean this functions do not consider uartConfig.flowControl          = FALSE falg? and set my P0.2 to 1 and the LED is on

how can I solv this

Thanks

  • Ok I found the problem I think it is a bug in the API. in the _hal_uart_dma.c 

    1-  in the function HalUARTPollDMA()  you will find this line

      //    PxOUT |= HAL_UART_Px_RTS;  // Disable Rx flowcontrol. 03.05.2011 shlud be commented out

    and in function HalUARTReadDMA()

    the line  //  PxOUT &= ~HAL_UART_Px_RTS;  // Re-enable the flow on any read.  shlud be commented out too

     

    or use if (config->flowControl) to change the  source code

  • in _hal_uart_dma.c we have:

      if (config->flowControl)
      {
        UxUCR = UCR_FLOW | UCR_STOP;
        PxSEL |= HAL_UART_Px_CTS;
        // DMA Rx is always on (self-resetting). So flow must be controlled by the S/W polling the Rx
        // buffer level. Start by allowing flow.
        PxOUT &= ~HAL_UART_Px_RTS;
        PxDIR |=  HAL_UART_Px_RTS;
      }

    I would agree that for completeness we should look at the flowControl flag in the other two functions as well. However, if you are not using flow control at all this should not matter because you would not be looking at the RTS signal from the CC2530 anyhow. I've never had any problems with using the default code with and just Rx and Tx (P0.2, P0.3).

  • As I entioned I have a LED connected to PIN  P0.5 if  I set a Breackpoints on this two lines in _hal_uart_dma.c I get:

    PxOUT |= HAL_UART_Px_RTS;  // Disable Rx flow.                                               if this line executed  the LED goes on
     PxOUT &= ~HAL_UART_Px_RTS;  // Re-enable the flow on any read.              if this line executed  the LED goes oFF

    you can watch the IO values of the P0 in the Register window.

  • Oic! Thanks for the clarification about the issue. I agree this should be fixed.

  • Hi R.Nouna,

    I'm trying to use UART with DMA support on cc2530. I want to disable flow control like you did. I commented out the lines you mentioned in your posts and disabled flow control in my uart configuration. The thing is, i want to use the pins that WOULD be RTS,CTS (IF flowcontrol was enabled) to connect them elsewhere. Is there a sure way to COMPLETELY DISABLE flow control so that  P1.4 and P1.5 can be used for other uses?Thanks in advance

     

    My configuration for UART is the one below("inspired" from the SerialApp configuration):

     

     

      halUARTCfg_t uartConfig;

      uartConfig.configured           = TRUE;             

      uartConfig.baudRate             = HAL_UART_BR_57600;

      uartConfig.flowControl          = FALSE;// i dont want to use flow control**

      uartConfig.flowControlThreshold = 64; 

      uartConfig.rx.maxBufSize        = 128; 

      uartConfig.tx.maxBufSize        = 128; 

      uartConfig.idleTimeout          = 100;  

      uartConfig.intEnable            = FALSE;            

      uartConfig.callBackFunc         = my_Cb;

      HalUARTOpen (0x01, &uartConfig);


     

    also i have made these definitions on the preprocessor:

    HAL_UART=TRUE

    HAL_UART_DMA=2 //i want to use PORT 1 Alt. configuration 2 

     

    Thanks in advance

    Nikos

  • hi,

    if you use DMA only for UART, than he configuartion schould work as I mentioned last posting. the 2 line RTS and CTS can be configured as GPIO.
    If you use DMA for writng in flash to than you have to comment out more than the 2 lines (use searsch in source code to find it). and that is not really work. so I swaped to ISR by the UART and use DMA for Flash.

    Regards

  • Thanks a lot for the response! I'll try it!

    Nikos