chipKIT® Development Platform

Inspired by Arduino™

Help with debug

Created Tue, 28 Aug 2012 15:54:26 +0000 by ericir


ericir

Tue, 28 Aug 2012 15:54:26 +0000

Hola everyone,

I am working with a ChipKit MAX32 and I have some problems debugging. I would like to debug without using MPLAB or any external debug tool. I would like to print in the serial monitor screen any processing variables (strins, float values, etc).

I have tried printf and it didn't work, how could I do it?

Thank you in advance, Eric.


Jacob Christ

Tue, 28 Aug 2012 17:03:05 +0000

Serial.println()

Try looking at the communications examples.

Jacob


ericir

Wed, 29 Aug 2012 08:58:56 +0000

Excuse me, but I'm new on Chipkit MAX32 and I have not much practice. I would like to do that using the USB connection of the Chipkit but I don't know how. Please, coul you tell me some link to look at some example?.

Thank you in advance.


majenko

Wed, 29 Aug 2012 09:31:22 +0000

Communicating over the USB is done via a USB serial device. The computer sees the ChipKit as a standard RS232 device (COM3, etc). When you work with serial on the ChipKit it not only communicates through pins 0 and 1, but also via the USB RS232 adaptor.

To start the connection, you can use something like:

Serial.begin(9600);

to configure the serial connection to 9600 baud.

You can then send data from the ChipKit to the computer using commands like:

Serial.print("Hello World");

and

Serial.println(myTemperatureVariable);

For reading data from the computer you have the read() and available() functions:

if(Serial.available()>0)
{
  myChar = Serial.read();
}

That will check to see if there is any data waiting to be read, then read one character (or byte) into the myChar variable.

At the computer's end, you can either use the built-in Serial Monitor of the mpide, or use some other program such as Hyperterm to access the COM port of the ChipKit. Note that the baud rate has to match what you configured in the Serial.begin() function call.


ericir

Wed, 29 Aug 2012 15:08:37 +0000

I have used your suggestions and it worked. Thank you very much, now I can continue with my project and I will be able to go deeply in the world of ChipKit.

¡Gracias!