PSoC 4 BLE - Read Barcode Input Using UART

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi,

I am trying to read a value form a barcode scan using UART and the RX pin on the CY8CKIT-042-BLE (PSoC 4 BLE). The following is my code (modified from the HID Keyboard Example, as the goal is to send the value of the scan to a device, emulating a keyboard). I am unable to get any results from the scan to output on a PuTTY terminal. Any ideas on what I am doing wrong?

int main()

{

   uint32 rxData;

    CyGlobalIntEnable;

     #if (DEBUG_UART_ENABLED == ENABLED)

         UART_DEB_Start();

     #endif /* (DEBUG_UART_ENABLED == ENABLED) */

         DBG_PRINTF("BLE HID Keyboard Example Project \r\n");

    Disconnect_LED_Write(LED_OFF);

    Advertising_LED_Write(LED_OFF);

    CapsLock_LED_Write(LED_OFF);

    /* Start CYBLE component and register generic event handler */

    CyBle_Start(AppCallBack);

    WDT_Start();

     #if (BAS_MEASURE_ENABLE != 0)

         ADC_Start();

     #endif /* BAS_MEASURE_ENABLE != 0 */

    while(1)

    {   

        /* CyBle_ProcessEvents() allows BLE stack to process pending events */

        CyBle_ProcessEvents();

        /* To achieve low power in the device */

        LowPowerImplementation();

   

        rxData = UART_DEB_UartGetChar();

         if(rxData)

         {

             UART_DEB_UartPutChar(rxData);

          }

.......

   

Thanks in advance,

Ryan

0 Likes
1 Reply
Anonymous
Not applicable

If you didn't setup your UART for interrupting the low power modes, then it won't wake up upon receiving UART data.

As a test, try commenting out the LowPowerImplementation(); and see if the unit starts echoing the data properly, if so, then it is the lower power mode not being setup correctly to allow UART wakeup/checking.

0 Likes