Developing CC3220 Wi-Fi Projects with Visual Studio

This tutorial shows how to use VisualGDB to create, build and debug a basic WiFi-enabled application for the CC3220S chip. We will start with creating a simple “Blinking LED” application, show how to verify the debug settings and then proceed to making and exploring a simple WiFi application.

Before you begin, install VisualGDB.

  1. Start Visual Studio and select File->New Project->VisualGDB->Embedded Project Wizard:01-newprj
  2. Proceed with the “Create a new project -> Embedded Binary” choice:02-elf
  3. On the next page select the ARM toolchain and choose the CC3200S device. In this tutorial we will be using the CC3220SF-Launchpad board with the CC3220SF device featuring 1MB of FLASH memory, however as of August 2017 no debugging tools support CC3220 FLASH programming, so we will limit our project to only use the RAM by selecting the CC3220S chip instead:03-device
  4. Select PWMLED on the next page:04-sample
  5. Go to the Debug Method page and connect the board to your computer via USB. VisualGDB should recognize it as a CMSIS-DAP debug probe and show it, although OpenOCD won’t automatically recognize the device type. Enable the “show raw OpenOCD scripts” setting and choose the “cc32xx.cfg” script:05-cc32xx
  6. Select JTAG as the debug protocol and press “Test”:06-jtag
  7. VisualGDB will launch OpenOCD and ensure that the chip can be debugged:07-test
  8. Press “Finish” to create the project and start debugging it by hitting F5. See how the two LEDs on the board begin to gradually turn on and off:board
  9. Note that the debugging with OpenOCD will be extremely slow:08-longstartThis happens because the on-board XDS110 debug probe is running in the compatibility mode with CMSIS-DAP and is using the slow USB HID mechanism to exchange data. To speed up debugging, we will now switch from OpenOCD to the proprietary TI XDS GDB stub. The TI GDB stub is less reliable, however it utilizes the proprietary TI commands to interface with the XDS110 debug probe, resulting in much higher performance.
  10. Download and install the TI XDS Emulation Software Package. Then locate the gdb_agent_console.exe file inside its installation folder and create another file called cc3220s.dat in the same folder with the following contents:
  11. You can configure VisualGDB to run the TI gdb server by selecting the “Custom GDB Stub” in the VisualGDB Debug Settings, however an easier way would be to register it with VisualGDB as another debug method. Create the following folder: %LOCALAPPDATA%\VisualGDB\EmbeddedDebugPackages\com.sysprogs.arm.ti.xds-gdbstub; then create a file called edp.xml inside it with the following contents:

    Do not forget to adjust the path to gdb_agent_console.exe in GDBServerApplication and GDBServerWorkingDir if you installed the TI debug tools in a different folder.
  12. Restart Visual Studio (or open and close the Tools->VisualGDB->VisualGDB Package Manager window). VisualGDB should now show the TI XDS GDB Stub in the debug method list under VisualGDB Project Properties -> Debug Settings:10-xdsChange the debug method to TI XDS GDB Stub and press OK to save it.
  13. Start debugging again. Notice how the debugging experience is now much faster:11-fast
  14. Now we will create a Wi-Fi-based project. Open the VisualGDB Embedded Project Wizard and select the “Network Terminal” sample:12-sample
  15. Ensure you select the TI XDS GDB Stub from the very beginning:13-debug
  16. The network terminal sample will accept user commands over the on-board COM port, so find out its number via Device Manager:14-uart
  17. Then enable VisualGDB Raw Terminal for that port (requires Custom edition) or use any other terminal program that is capable of connecting to COM ports:15-terminal
  18. Start debugging your project and note how the program shows the help screen via the COM port:16-command
  19. Run the following command to create a new Wi-Fi network:

    17-start
  20. Note the IP address reported by the demo program. Then connect to the CC3220 Wi-Fi network from your computer and open that address in a browser:18-page
  21. Now we will show how to run a basic TCP/IP test. Open the socket_cmd.c file and locate the TCPServer() function:19-tcpserver
  22. Use the “find all references” command to find that TCPServer() is called by the cmdSendCallback() function that is in turn registered as a callback for the “send” command. Set a breakpoint in the beginning of the TCPServer() function and type “send -p 1234″ in the network terminal console:20-send
  23. Run “telnet <IP address of the board> 1234″ to connect to the board. Note how the sl_Send() function will get called to send test data via the connection:21-send
  24. You can use the Code Map provided by the VisualGDB Clang IntelliSense engine to quickly find out the functions called by TCPServer() to get a quick overview of the TCP-related CC3220 API:22-methods