Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

UART Configuration trouble

$
0
0

Hi All, 

First post, be merciful.   I have CC2540-MINI keyfob setup, IAR 8.20 with 1.3 BLE Stack . My goal is to setup a simple UART communication link.  I studied DN112 to familiarize myself with UART configuration and principles.  I started a new project of existent KeyFob demo project and configured as such:

                    #define HAL_UART_DMA 2

void serial_init(){
  // Configure UART1 for Alternative 2 => Port P1 (PERCFG.U1CFG = 1)
  PERCFG |= 0x02;
  // P1SEL.SELP1_4/5/6/7 = 1 => CT = P1_4, RT = P1_5, TX = P1_6, RX = P1_7
  P1SEL |= 0xF0;
  // Configure relevant Port P0 pins back to GPIO function
  P0SEL &= ~0x3C;
 
 
  halUARTCfg_t uartConfig;
 
  // configure UART
  uartConfig.configured           = TRUE;
  uartConfig.baudRate             = HAL_UART_BR_115200;
  uartConfig.flowControl          = FALSE;
  uartConfig.flowControlThreshold = 48;
  uartConfig.rx.maxBufSize        = 128;
  uartConfig.tx.maxBufSize        = 128;
  uartConfig.idleTimeout          = 6;
  uartConfig.intEnable            = TRUE;
  uartConfig.callBackFunc         = serialPacketParser;
 
  // start UART
  // Note: Assumes no issue opening UART port.
  HalUARTOpen( HAL_UART_PORT_1, &uartConfig );
}

TX part works flawlessly on P1_6  using HalUARTWrite (DMA mod) function , however I have troubles with the  incoming traffic reception in p1_7. My serialPacketParser callback wouldn't get invoked. I was wondering if someone could shed some light onto this issue.

6pm UPDATE:

1) I moved my code to SimpleBLEPeripheral base, still the same. Only TX works.

2) I moved the same binary to c2540 USB stick. It's hard to believe but with USB stick RX works and TX does not. 

I program for 16 years, mostly c/c++/objc/py. I now consider this as a personal challenge. I have to figure this one before I loose respect for myself :) Btw all of the above can be accomplished with arduino in 3 lines of code. Maybe this 8051 architecture is thousand times more efficient, scalable, and faster. I'd really like to find out.

Thank you very much,

-B


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>