Go Down

Topic: Tty for serial port to Arduino from Linino (Read 17 times) previous topic - next topic

Federico Fissore

Can you retry with 250000 baud? That's the speed we set for ttyATH0
Have you upgraded the Yún? If you've just got it, then it needs to be upgraded! Check out the tutorial

wayoda


Can you retry with 250000 baud? That's the speed we set for ttyATH0

Doesn't work. For some reason I get incomplete readings for all speeds above 115200 baud. (230400, 250000 etc.)
I also tried to write smaller data packets of 16 bytes instead of 32 bytes, but no luck. Every baudrate above 115200 baud fails on the first write/read cycle.

But 115200 baud (10kB/s) is fast enough for most usecases where data from the ATmega32u4 is  being forwarded to a webservice.
I can live with that limitation.

scrot

I got Firmata to work between a Python script running on Linino and the Arduino.  I was able to get about 400 messages per second which is sufficient for my needs.  I made the following changes to the StandardFirmata sketch "begin" section.

Code: [Select]
void setup()
{
 
  Firmata.setFirmwareVersion(FIRMATA_MAJOR_VERSION, FIRMATA_MINOR_VERSION);

  Firmata.attach(ANALOG_MESSAGE, analogWriteCallback);
  Firmata.attach(DIGITAL_MESSAGE, digitalWriteCallback);
  Firmata.attach(REPORT_ANALOG, reportAnalogCallback);
  Firmata.attach(REPORT_DIGITAL, reportDigitalCallback);
  Firmata.attach(SET_PIN_MODE, setPinModeCallback);
  Firmata.attach(START_SYSEX, sysexCallback);
  Firmata.attach(SYSTEM_RESET, systemResetCallback);

  Serial1.begin(9600); // Set the baud.
  Firmata.begin(Serial1);
  systemResetCallback();  // reset to default config
}


On the python I installed PyFirmata and pyserial.  The following code turns on the LED:

Code: [Select]
from pyfirmata import Arduino, util
board = Arduino('/dev/ttyATH0', baudrate=9600)
board.digital[13].write(1)

GreyCon

Hi Wayoda,

   when you say a BAUD rate of 250000 fails - do you get characters from Serial, or nothing at all? The Arduino UART should definitely do 250000 , and higher. And since the hard-wired serial connection is very short, there shouldn't be any signal degradation issues.

Maybe you have a marginal board. I will give it a go tonight and let you know results. If necessary we can look at the UART registers for over-run or parity errors....

Con

wayoda


Hi Wayoda,
   when you say a BAUD rate of 250000 fails - do you get characters from Serial, or nothing at all?


The python script writes 32 chars to the ATmega and then reads 32 bytes with a five second timeout.
When used with baudrates above 115200 the read returns unexpected characters and also too few of them.

Go Up