Other Parts Discussed in Thread: CC2540
Looking for help/advice.
I am using BTool.exe with the HostTestApp project on BlueGiga BLE112 hardware with CC2540F128. Using the CC2540USB configuration and communicating with USB, BTool.exe works great.
Now I want to use the physical serial port. I changed to the CC2540EM Master configuration. I performed modifications in _hal_uart_isr.c similar to those described in http://e2e.ti.com/support/low_power_rf/f/538/p/99676/349193.aspx#349193 to change the UART0 to the Alt. 2 configuration.
For an interface to the PC, I'm using an FTDI chip with FTDI RTS wired to CC2540 CTS and FTDI CTS wired to CC2540 RTS.
In BTool.exe, I'm using 57600,N,8,1 setting with CTS/RTS enabled. When the conversation with the device starts, the first command is processed, but subsequent commands are ignored (see sample output below):
Port opened at 7/14/2011 12:56:27 PM
[1] : <Tx> - 12:56:27.517
-Type : 0x01 (Command)
-Opcode : 0xFE00 (GAP_DeviceInit)
-Data Length : 0x26 byte(s)
ProfileRole : 0x08 (Central)
MaxScanRsps : 0x03
IRK : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
CSRK : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
SignCounter : 0x00000001
Dump(Tx):
01 00 FE 26 08 03 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 01 00 00 00
-----------------------------------------------------------------------------------------------
[2] : <Rx> - 12:56:27.658
-Type : 0x04 (Event)
-EventCode : 0xFF (HCI_LE_ExtEvent)
-Data Length : 0x06 bytes(s)
Event : 0x067F (GAP_HCI_ExtentionCommandStatus)
Status : 0x00 (Success)
OpCode : 0xFE00 (GAP_DeviceInit)
DataLength : 0x00
Dump(Rx):
04 FF 06 7F 06 00 00 FE 00
-----------------------------------------------------------------------------------------------
[3] : <Tx> - 12:56:27.814
-Type : 0x01 (Command)
-Opcode : 0xFE31 (GAP_GetParam)
-Data Length : 0x01 byte(s)
ParamID : 0x15 (TGAP_CONN_EST_INT_MIN)
Dump(Tx):
01 31 FE 01 15
-----------------------------------------------------------------------------------------------
[4] : <Tx> - 12:56:27.814
-Type : 0x01 (Command)
-Opcode : 0xFE31 (GAP_GetParam)
-Data Length : 0x01 byte(s)
ParamID : 0x16 (TGAP_CONN_EST_INT_MAX)
Dump(Tx):
01 31 FE 01 16
-----------------------------------------------------------------------------------------------
[5] : <Tx> - 12:56:27.814
-Type : 0x01 (Command)
-Opcode : 0xFE31 (GAP_GetParam)
-Data Length : 0x01 byte(s)
ParamID : 0x1A (TGAP_CONN_EST_LATENCY)
Dump(Tx):
01 31 FE 01 1A
-----------------------------------------------------------------------------------------------
[6] : <Tx> - 12:56:27.830
-Type : 0x01 (Command)
-Opcode : 0xFE31 (GAP_GetParam)
-Data Length : 0x01 byte(s)
ParamID : 0x19 (TGAP_CONN_EST_SUPERV_TIMEOUT)
Dump(Tx):
01 31 FE 01 19
-----------------------------------------------------------------------------------------------
[7] : <Rx> - 12:56:27.830
-Type : 0x04 (Event)
-EventCode : 0xFF (HCI_LE_ExtEvent)
-Data Length : 0x2C bytes(s)
Event : 0x0600 (GAP_DeviceInitDone)
Status : 0x00 (Success)
DevAddr : C0:FF:EE:C0:FF:EE
DataPktLen : 0x001B
NumDataPkts : 0x04
IRK : A9 9C 02 FD 10 C3 85 0C 88 E0 A8 66 F2 BE 43 07
CSRK : BC 55 B7 B1 77 B7 1B 27 E5 8A B6 48 F7 B4 D3 C7
Dump(Rx):
04 FF 2C 00 06 00 EE FF C0 EE FF C0 1B 00 04 A9
9C 02 FD 10 C3 85 0C 88 E0 A8 66 F2 BE 43 07 BC
55 B7 B1 77 B7 1B 27 E5 8A B6 48 F7 B4 D3 C7
-----------------------------------------------------------------------------------------------
[8] : <Tx> - 12:59:07.697
-Type : 0x01 (Command)
-Opcode : 0xFE04 (GAP_DeviceDiscoveryRequest)
-Data Length : 0x03 byte(s)
Mode : 0x03 (All)
NameMode : 0x01 (Enable)
WhiteList : 0x00 (Disable)
Dump(Tx):
01 04 FE 03 03 01 00
-----------------------------------------------------------------------------------------------
[9] : <Warning> - 12:59:22.680
Scanning Timeout...
When I probe RTS on the CC2540 with an oscilloscope, it is stuck at 1 (de-asserted) after the first command. I have to reset the CC2540 for RTS to assert again.
I was wondering whether BTool.exe is sending commands too quickly, so I wrote a LabVIEW routine to send only a single command (GAP_DeviceInit) instead of the sequence of multiple commands that BTool.exe uses. The CC2540 processes the single command, but RTS remains de-asserted (logic 1) so I can never send another command.
I've also tried disabling CTS/RTS handshaking by making the following change in _hal_uart_isr.c:
static void HalUARTOpenISR(halUARTCfg_t *config)
{
// TODO: CLN 13-July-2011 Think the halUARTCfg_t is instantiated in
// the BLE stack, so don't know if I have access outside context of
// HCI_Init(). I will override settings here unless I can find a better
// place later.
// config->baudRate = HAL_UART_BR_38400;
config->flowControl = HAL_UART_FLOW_OFF;
This seemed like the most appropriate place to change the UART settings since I couldn't find where the referenced halUARTCfg_t is defined. I assume that HalUARTOpenISR() is being called from the stack.
With CTS/RTS disabled, I see the same behavior. Only one command over UART gets processed, then the CC2540 does not respond to further commands.
Has anyone experienced a similar issue? Before I start debugging the UART HAL code, I want to make sure I'm not missing anything obvious.
Thanks,
Chris Norris