Hello,
I’m attempting to use CoolTerm as a serial monitor for debugging purposes when working with an Arduino Mega (2560), but have noticed that CoolTerm is not accurately receiving the serial data being transmitted to it from my Mega. (FWIW, I’m running on a Mac - OS 10.9.1). CoolTerm seems to be displaying serial data from the Arduino Mega in short bursts every 5 - 15 seconds even though it should be displaying a continuous stream of values every second.
I originally noticed this when attempting to debug a large sketch wherein I’m configuring my Arduino to receive MIDI data being transmitted from a MIDI controller and use the MIDI signals to control a variety of LEDs, servos, and a stepper motor.
This is my serial data flow configuration:
MIDI Controller MIDI output —> Hairless MIDI/Serial Bridge —> Arduino Mega —> CoolTerm
For testing purposes, I created a much simpler sketch to rule out any other possible issues in my code:
#include <MIDI.h>
int testVal;
//=================ARDUINO SETUP FUNCTION=====================
void setup() {
//MIDI & serial setup
MIDI.begin();
Serial.begin(57600);
MIDI.turnThruOff();
MIDI.setHandleControlChange(ControlViaCC);
testVal = 0;
}
//================VOID LOOP FUNCTION======================
void loop() {
while(MIDI.read())
true;
Serial.println(testVal);
}
//==============CC CALL BACK================
void HandleControlChange (byte channel, byte number, byte value);
void ControlViaCC (byte channel, byte number, byte value)
{
if (number == 71) //rotary encoder 'B1' on axiom controller
{
testVal = value; //pure CC value (0-127) for testing purposes
}
}
In spite of its simplicity, when running this code on my Mega, CoolTerm still displays delayed serial transmissions in irregular bursts.
I’ve ensured that the baud rate settings of my Arduino, the Hairless MIDI Serial Bridge, and CoolTerm are all set to transmit and receive at the same rate (in this example, 57600 baud, 8 data bits, no parity, and 1 stop bit.)
I ran the same code using the same connection configuration and baud rate settings as above on an Arduino Pro Mini (3.3V, 8Mhz w/ ATmega328), and CoolTerm picks up the serial data transmitted from the Arduino Pro Mini just fine (in a continuous stream of values in real time).
All other things being equal, it seems like the Mega is the only variable creating the delayed serial transmission to CoolTerm. Why does the serial output from my Mega display in CoolTerm in an irregular and delayed fashion while the serial output from my Arduino Pro Mini does not?
Thank you in advance for your help.