This is a continuation of the last post and highlights a quick guide on how to have a quick remote debug console for the CC3200. One can use UART connection for debugging or can use a socket to send debug messages to a remote console server.
Starting from the TCP Socket CC3200 sample project, I have decoupled the WLAN and TCP Client parts inside main.c and encapsulated them into a more portable and reusable code fragments. The main.c has now been transformed as:
void main() { BoardInit(); UDMAInit(); Hardware_Init(); /* WLAN Connect */ WLAN_Initialise(); WLAN_Connect(SSID_NAME, SECURITY_KEY, SECURITY_TYPE); /* We are connected to the network, setup a TCP Client * and connect to the server */ TcpClient_Init(); ConnectToTcpServer(IP_ENDPOINT, IP_PORT); while (true) { /* Send some data to remote server */ TcpClient_Write("Can be debug message...", 23, 0, 0); /* stall for a second */ Delay(1000); } }
The remote console is really a TCP server running on a Desktop machine or Beagle Bone. For the TCP server running on the Desktop, a quick Google search will result in a few TCP tools for Windows, MAC or Linux, or you can roll your own using C# .NET with this sample program ready to go. Using the Beagle Bone is quite easy as well by writing a simple nodeJS script in Cloud9 IDE of the Beagle Bone.
Using the files is quite straightforward and hope the API are self-explanatory. One thing to note though, when connecting to a TCP server, the IP address argument is of an array of 4 bytes representing the endpoint IP address. i.e. to connect to a TCP server with address 192.168.1.60 on port 40000, you can do the following:
uint8_t endPoint[4] = {192, 168, 1, 60}; uint16_t port = 40000; TcpClient_Connect(endPoint, port);
Disclaimer:
The attached code in this blog post is shared to the community as is.