Increasing Baudrate Above 115200 Not Working!

I've been reading all the forums of similar issues. Right now I'm trying to get information faster from the Arduino Mega. Anytime that I increase the baudrate above 115200, even when using recommended values, I don't get information any faster. Is there something else I need to do to increase Baud above 115200?

You have not told us what is at the other end of the comms link.

AFAIK 115200 baud is the max for the Arduino Serial Monitor.

I have had no problem operating with 500000 baud (and 1,000,000 IIRC) with other PC software on the other end.

…R

Sorry for not giving you the rest of the info. I'm sending it to the PC and using the python serial library to read from it. I even checked the TX pin on the arduino with an oscilloscope to see if the frequency was increasing as I increased the baudrate, but as I went above 115200 baud the frequency on the o-scope stayed the same.

I'm pretty sure I have had high baud rates working with Python. Actually I just found one of my test programs and I was using JRuby and the Java JSSC library. It worked at 230400, 500000, and 1000000 but not 250000 baud. I may also have tested it with Python at the same time.

I don't have time to do a new test today.

I have never checked the Tx frequency with a 'scope so I won't comment on that.

...R

Have you tried this on an Uno to see if the problem persists? Which serial port are you usning?

I haven’t tried it on an arduino uno. I’m using the ttyAMC0 serial port. Here’s what my code currently looks like:

// this program is the initial version for the new tactile sensor. 27 pins are powered while 11 pins are analog read pins

int Dpin[27]; 

char Apin[11] = {A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15};

void setup()
{
 Serial.begin(1000000);  
 
 //set and configure digital pins to outputs
 //digital pins 0 and 1 are used for serial communication, so use A0 and A1 for the first two digital outputs
for( int i = 0; i < 11; i++)
{
  pinMode(Apin[i],INPUT);
}
  
 for( int i = 0; i < 13; i++) 
 {
  Dpin[i] = i+37;
  pinMode(Dpin[i],OUTPUT);
 }
 
  for( int i = 13; i < 27; i++) 
 {
  Dpin[i] = i+9;
  pinMode(Dpin[i],OUTPUT);
 }

}

void loop()
{
 // begin reading from row 1 column 1 and move through each column. Read from row 2 column 1 and read through each column...etc.
 for(int j = 0; j < 11; j++)
 {
   //print a row indicator to be used for keeping track of which rows are being read. 

   Serial.print(j);
   Serial.print('\t');
   
   // cycle through each of the digital I/O pins
   for(int i = 0; i < 27; i++)
   {

    digitalWrite(Dpin[i],HIGH);

    int val = analogRead(Apin[j]); 

    Serial.print(val);

    digitalWrite(Dpin[i],LOW);

    if(i < 26)
    {
      Serial.print("\t");
    }
    
   }
   
   Serial.println();
 }
}

currently the entire program takes about 77 ms to run, but I need to get it to go much faster. I thought the baudrate was my limiting factor, but I’m not sure. Any thoughts on how I might get this program to run faster?

Please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor. See How to use the Forum

You need to find out what is slowing things down. I suggest 2 separate tests.

First comment out all the print commands within loop() except a simple Serial.println(“end”); as the last thing.

Second, restore the print commands and comment out the analogRead().

You can easily measure how long a piece of code takes by saving the value of micros() before and after and printing the difference.

…R