Page 1 of 1

Serial Communication from the Yocto

Posted: Sep 24th, '17, 07:03
by helectromagneticus
Hello everyone,

How are you firmware development folks getting information from the ATmega1284 on the Yocto to your development computers? Looking at the Yocto board, there's no easy way to attach wires to either of the two serial ports on the MCU. However, looking over the source code, one can see a few "Serial.println();" calls that suggest serial communications. Any thoughts here?

Or, is there a way to get information from the Yocto to a PC over the SPI interface? Perhaps that Yocto MCU could act a SPI master to an Arduino Uno? It looks like this gentleman here got such a system working with a Pro Mini, and he links to a solution with an Uno by Nick Gammon. What do you folks think?

Re: Serial Communication from the Yocto

Posted: Sep 24th, '17, 10:44
by antto
yup, that's one of the discouraging aspects of the yocto cpu
the fact that the PCB is black also doesn't help much
there is a 10pin (5x2) header near the cpu, which smells like avr ISP connector, but it's not labelled, so who knows

other than that, you could check the available USARTs on the chip, and try to see if those pins go onto traces somewhere on the PCB (that would be easiest if you have a schematic and/or board layout files to look at)
if you find an USART module with both TX and RX pins not used (and not connected to anything on the PCB) then i can think of a little dirty hack:
use a an extra 40-pin IC socket, plug the CPU onto it, bend the pins where the RX+TX are on that socket sideways and solder wires to them, then plug that whole thing into the socket on the PCB
you'd also need to connect another wire to a ground point (preferably taken from somewhere in the digital section of the circuit)
now, you have three wires TX RX GND, you can use a USART<->RS232 converter box, or a USART<->USB converter box
don't connect the USART directly to a RS232 port on a computer because RS232 is not 5V

if you actually only need to print out debug information - you only need the TX pin (and GND), but having both TX and RX available on the same USART module is a better option, because then that can be used for a serial bootloader (because MIDI is damn slow)

Re: Serial Communication from the Yocto

Posted: Sep 25th, '17, 06:10
by helectromagneticus
I've figured it out with a good guess and a multimeter. The pair of pins next to the SPI header are the serial RX/TX lines. You can get serial out from the ATmega1284 on the Yocto that way.

Using an Arduino Uno to read serial from the Yocto:
Image
  • Make the connections described in the image above (if you don't want to program the Yocto over SPI, you still need the GND connection from the SPI header)
  • Connect GND to RST on the Uno (note that you must break this connection if you want to program the Yocto over SPI!)
  • Use the "Serial Monitor" under the "Tools" section of the Arduino IDE
  • Set the baud rate to 115200
Things to watch out for:
  • The TX line can't be connected during programming over SPI, avrdude will spit out a "not in sync" error.

Re: Serial Communication from the Yocto

Posted: Sep 25th, '17, 08:04
by jvq
Neat!

I've been doing my debugging in a very crude way, by lighting up LED's. Using the serial port must be much nicer.

Re: Serial Communication from the Yocto

Posted: Sep 30th, '17, 20:50
by helectromagneticus
jvq wrote:Neat!

I've been doing my debugging in a very crude way, by lighting up LED's. Using the serial port must be much nicer.
Thanks!

Re: Serial Communication from the Yocto

Posted: Dec 15th, '18, 23:18
by rv0
I've been trying this to get serial text out from the Yocto

RX TX connection as described in above image.
Also Yocto GND to Arduino RST
Using a cheap UNO clone

When I open serial monitor some characters I print are corrupt. Space prints as 8, 0 as <, A as a, ... It's semi random, sometimes some characters get corrupt, sometimes they don't.. Baud rate is correct. Very confusing for debugging of course.

I first blamed my Uno clone, tried another type of clone and the problem is the same. Then blamed the Yocto, took another one (from same batch though), same issue. Then blamed my Mac, so tried a raspberry pi with the Arduino IDE and the same problem occurs.

Not sure where to go from here.. I could try to get my hands on a real arduino uno.. Or maybe make something to connect the yocto straight to the raspberry pi.

Anyone got any clues?


EDIT: :roll: why is it always right after I ask for help online that I figure it out :roll:
The problem is I didn't connect GND of the Yocto to GND of the Arduino. Fixed now, time to debug 8-)