Slight Modification to UART to BLE

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

cross mob
Anonymous
Not applicable

The current UART to BLE is set up such that the UART only seems to function when there is a wireless link.   If I am an MCU that wants to convey information to the BLE module, which the BLE module alone will use, I would like to use the UART without a link necessarily being established.   I thought is was as easy enough as using HandleUartTxTraffic (naming convention strange) under the CYBL_STATE_ADVERTISING case in the HandleBleProcessing Procedure, but this does not work.   It would be nice to tie this communication to an interrupt that occurs when data appears in the Receive Buffer of the Processor.

0 Likes
1 Solution
Anonymous
Not applicable

The example UART to BLE example is meant to be a wireless UART bridge (from x UART to y UART using BLE as a medium).

   

HandleUartTxTraffic is a custom application function written to handle the UART traffic and send it directly through the BLE medium/connection using notifications. It is all listed in the comments of the associated source and header files under the example project.

   

If you merely want to receive UART data to the cypress chip, try the standard UART example through the PSoC Creator "Code Examples" when creating a new project.

   

Here is a PDF example that will walk through setting up a simple echo-back function on the PSoC chip. http://www.cypress.com/documentation/code-examples/ce95366-psoc-4-scb-uart

View solution in original post

0 Likes
6 Replies
Anonymous
Not applicable

The example UART to BLE example is meant to be a wireless UART bridge (from x UART to y UART using BLE as a medium).

   

HandleUartTxTraffic is a custom application function written to handle the UART traffic and send it directly through the BLE medium/connection using notifications. It is all listed in the comments of the associated source and header files under the example project.

   

If you merely want to receive UART data to the cypress chip, try the standard UART example through the PSoC Creator "Code Examples" when creating a new project.

   

Here is a PDF example that will walk through setting up a simple echo-back function on the PSoC chip. http://www.cypress.com/documentation/code-examples/ce95366-psoc-4-scb-uart

0 Likes
Anonymous
Not applicable

Thanks.   I will take a look, but are you implying that the same UART can either be user as a wireless UART bridge OR a standard UART, but not BOTH, nor with a mechanism to switch between them?

0 Likes
Anonymous
Not applicable

OK, you are not implying that it will not work ( a UART is after all a UART), simply that I cannot use the canned function which implements to BLE to UART.   I can still use, for example, UART_UartGetChar() from UART_UART.c inside the CYBLE_STATE_ADVERTISING state, and have the UART function properly.

0 Likes
Anonymous
Not applicable

I'm saying that the particular UART over BLE example is setup to only do the UART->BLE->UART connection. In order to manipulate it for either: UART only, UART->BLE->UART, or both you will need to modify the code from the example to allow either switching the mode, or sending to one or both connection interfaces.

   

Since you want the UART link to be used separately from the BLE link, I would suggest rewriting how the main.c code handles the UART traffic; That way, it will only forward data to the wireless link when you want it to. Otherwise, the code in the example UART-over-BLE example will prevent it as you were seeing. 

   

To summarize: It is possible to implement a method to send data from a UART to a UART and/or BLE-connected device, but you will need to rewrite the code from the example to do that. Since the UART over BLE example is written to replace the wired cable of the UART transmissions, I would recommend starting with the UART example from the PSoC creator, and then modifying it with the code from the UART over BLE example to make it echo over the BLE link if that is what you are trying to do.

Anonymous
Not applicable

No, I already did that and put the Uart routines inside state where the BLE is advertising but not connected.  I am filtering for different commands sent to it, and the function works fine.  Thanks for the direction.

Anonymous
Not applicable

Sounds like you got it working. You're welcome. Good success with the endeavor 🙂

0 Likes