How can I receive bytes on the "test UART" AKA HCI_UART?

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

cross mob
Anonymous
Not applicable

I am writing firmware for the BCM20736 using the WICED tools on Windows 8.1 and I need help in understanding how to receive bytes on the "test UART" AKA HCI_UART.  The ble_trace0() function can send bytes, but how do I receive them?

I see the following functions that might be related, but can't find adequate documentation on how to use them:

A. bleprofile_regHandleUARTCb( BLEPROFILE_DOUBLE_PARAM_CB cb)

   1. Does the callback return data, the number of bytes, or only inform the application that data is ready?

B. bleprofile_ReadUART(char *data)

   1. Does this function block?

   2. Is there a way to tell how many bytes were returned?

C. Is there a lower level function than ble_trace0() for sending bytes out the test/HCI UART port?

D. Are there other functions to support this UART?

Thanks in advance,

    Aaron

0 Likes
1 Solution
JacobT_81
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

Correct, HCI UART use is not allowed at the application level. Those APIs are not for use of the HCI UART. HCI UART is only to be used for downloading and for running traces.

What's the reason for your needing to use the HCI UART in your application? If this is a result of GPIO shortage, I recommend taking a look at the patch in the most recent Windows SDK called hci_uart_pins_as_gpio.h. This patch should allow you to utilize the pins AFTER boot up. But if you hold the HCI Rx line high during boot up, you'll enter download mode and the program will never execute.

Jacob

View solution in original post

0 Likes
12 Replies
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

The HCI UART can ONLY be used to program the device, no exceptions.

To do this, you will need to use the SDK or the command line tools.

0 Likes
Anonymous
Not applicable

I am not sure if you understand my question.  After using my PC and serial cable to program the part through the part's HCI_UART, I am then interfacing the part to a micro-controller through the BCM20736S pins 18 and 19.

I am writing firmware on the BCM20736, and so am already using the WICED Smart SDK.  The functions I mentioned above are SDK functions.  How do I use the SDK to receive characters on this UART?

Thanks,

     Aaron

0 Likes
Anonymous
Not applicable

Looking for some clarification, please. The HCI_UART is used for programming the BCM2073x parts, but also provides a port for transmitting debug info using the tracex() commands in the SDK. The tracex() info is transmitted out the TX pin.  Are you saying that the RX pin is not supported for the user's application?

I was thinking that the two functions, bleprofile_regHandleUARTCb and bleprofile_ReadUART were supporting this UART instead of the PUART. Please let me know if these are intended for the PUART instead.

Thanks,

     Aaron

0 Likes

Traces can be directed to the HCI UART.  If you look in the WICED Smart Quick Start Guide (SDK 2.x and TAG3 Board), there is a section dedicated to setting up traces.  In addition, there is an encoded trace viewer within the SDK/IDE.  I believe it is used to decode the traces sent from the HCI UART.

The HCI UART is not available to the user's application.

0 Likes
Anonymous
Not applicable

What is the use of the following two functions:

     bleprofile_regHandleUARTCb()


     bleprofile_ReadUART()

Which UART do these apply to?

Thanks for your help.


-Aaron

0 Likes

I checked and found them declared in bleprofile.h and I'm 99% sure they apply to the PUART.

I will ask jakewtorres to confirm.

0 Likes
JacobT_81
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

Correct, HCI UART use is not allowed at the application level. Those APIs are not for use of the HCI UART. HCI UART is only to be used for downloading and for running traces.

What's the reason for your needing to use the HCI UART in your application? If this is a result of GPIO shortage, I recommend taking a look at the patch in the most recent Windows SDK called hci_uart_pins_as_gpio.h. This patch should allow you to utilize the pins AFTER boot up. But if you hold the HCI Rx line high during boot up, you'll enter download mode and the program will never execute.

Jacob

0 Likes
Anonymous
Not applicable

Thanks Jacob. We will redesign our PCB accordingly, but it is not an issue of GPIO shortage.

My client used the HCI UART based on the assumption that the application could use it. After looking through the forums, I can see that many have asked the question and it is well answered there. However, the main BCM20736/7 documentation from Broadcom does not make this clear.

Thanks for clarifying.

-Aaron

0 Likes

There is a brief mention of this within the WICED™ Smart Hardware Interfaces guide, page 15:

Peripheral UART

The BCM20732 has two UART interfaces. One is the factory or HCI UART that is used for programming and

factory testing. The other is the peripheral UART, which is available for application use to output debug

messages/tracing or to interface with a peripheral device/microcontroller. The following sections describe the

peripheral UART only. The HCI UART is not available for application use.

0 Likes
Anonymous
Not applicable

Thanks. However, this guide is for the BCM920732. How much of it applies to the BCM20736/7 parts?

0 Likes

From the perspective of HW interfaces/pinouts, all three parts are identical.

The firmware is where the differences lie as 20732 uses A0 firmware and the 20736/37 use A1.

While code compatible, the firmware you generate for one will not run on the other.

0 Likes
Anonymous
Not applicable

Thanks, that's great to know. It should save me a lot of time going forward.

-Aaron

0 Likes