4 Replies Latest reply on Jul 10, 2014 3:13 PM by mitoc_1583836

    Information: Debug the BCM20732 Tag over HCI-UART using a COM port via USB on the PC

    MichaelF_56

      The following procedure demonstrates how to use ble_trace (printf based traces) with the WICED Smart SDK TAG:

      1.
      Open the WICED Smart IDE

       


      2.


      In the directory tree on the left hand side, find WICED-Smart-SDKWiced-Smartsparcommonspar_init.c and open it for editing 

       

      Modify the SPAR_APP_SETUP function such that the trace enable flag is set to 2  (per previous posts on the forum, this directs traces to the HCI UART)


      Example:

       

      void SPAR_APP_SETUP(void)

      {

          bleapp_pre_init = application_init;

          bleapp_trace_enable = 2;        //Direct traces to HCI UART, default value = 1

      }

       

      3.

       

      Compile and download to the Tag board your favorite application. I used the Heart Rate Monitor sample application described within the Quick Start guide (ROM.heart_rate_monitor-BCM920732TAG_Q32 download).

       

       

      4.

       

      When you see Application is running message on the console window, unplug the USB cable from the Tag board.

       

      5.

       

      Find the mini-switch on the Tag board (S4).  If you were able to successfully download the application to the Tag board in step 3 above, then each of the four switches on the mini-switch (S4) are set to the ON position, or UP. Turn off two of the four switches in the middle of S4 (outside switches remain on).  When you are done, the four switches will be set as follows: UP, DOWN, DOWN, UP

       

       

      6.

       

      Plug the Tag board back into your computer.

       

      7.

       

      Open Windows “Device Manager” and determine which COM port is being used for the Tag board.  On my machine, COM3 was selected.  On Windows 7: Start->Computer->System Properties->Device Manager, then find the entry for “Ports (COM and LPT)”.  If you are not sure which one is being used by the Tag board, you may want to unplug it, then plug it back in while observing which COM port was added.

       

       

       

      8.

       

      Now open your favorite terminal emulation program (I use Tera Term) and connect to the COM port you identified in step 7.

       

      -In addition, you will need to make sure the Serial Port settings are as follows (in Tera Term, this is under the Setup->Serial Port menu item): Baud Rate: 115200, parity: None, Stop: 1, Flow Control: None

       

      -You will also want to go into the VT100 terminal settings (in Tera Term, this is under the Setup->Terminal menu item) and insure that the receive coding is set to UTF-8 and the New Line->Receive parameter is set to Auto (“CR” was default under Tera Term)


      9.

       

      Debug output should now appear within the terminal emulation window and you are now using the HCI port to output debug traces over the COM port attached via USB to your computer. You can push the Reset button to restart the application and see the startup traces.


      In doing such, you are effectively monitoring ble_tracex function calls within the application inside a terminal emulation window attached to the COM port.

       

      To make changes and download a new version of the application to your board, perform the following steps:


      1.

       

      Exit the COM port access application described above and used to monitor debug output traces.


      2.

       

      Unplug the Tag board and make sure each of the four switches on the mini-switch (S4) are set to the ON position, or UP. 

       

       

      3.

       

      Plug the Tag board back to your computer and the downloading a new application onto the Tag board should work exactly as described in the Quick Start manual which is available here on the WICED Smart website.