looking through the library I notice that if you include “3pi.h” you will get only one UART available (_SERIAL_PORTS defined to 1). The orther two ones (UART1 and UART_USB) are only available for OrangutanSVR and OrangutanX2.
What should I include and/or define to get the other two port available through the library?
I believe 3pi can handle the other two, however library is not correcting defining this.
Thanks for any help.
The ATmega328P used on the 3pi only has one hardware UART (and the 3pi has no USB), which is why the library defines _SERIAL_PORTS as 1. If you want additional serial ports, you might look into software serial.
how about USB AVR Programmer? I believe this use another UART (UART1) for programming Atmega328p. Is it right?
When I plug the USB AVR (as stated in doc) the programmer attaches 2 serial ports to my computer (/dev/ttyACM0 and /dev/ttyACM1).
In fact, I’m trying to use /dev/ttyACM1 to communicate with 3pi robot. When you look to simplified schematic (@ [pololu.com/docs/0J21/5.e]) it is clear that AVRISP is not connect to PD0 and PD1 used by UART0. My communication with UART0 is working and USB AVR programmer too.
So, there must be another serial ports out there
One of the serial ports that appears when you plug in the USB programmer can only be used for programming the AVR chip, using pins SCK, MISO and MOSI.
As Ben suggested, you can add software serial ports (code which defines an available I/O pin as an additional TX or RX), and use the “other” serial port on the USB programmer, or a separate USB-to-serial interface board, to communicate with the 3pi. This would been in addition to the hardware serial port that uses PD0 and PD1.
This is my main intention: use the other serial port. However, I’m finding no information how to get this available on 3pi.
Is there any link/resource you can point to me?
There is no “other” serial port on the 3pi, unless you define one with software.
Google “AVR software uart” for suitable code to incorporate into your program.
I noticed this is an old post, but I am interested in defining a serial port with software. I Googled about it, but the libraries I found are for Arduino, e.g. http://arduino.cc/en/Reference/softwareSerial. Is there a library that implements a software serial port for Pololu 3pi?
I found this thread on AVR Freaks that links to a few software serial libraries that might work with the 3pi.
By the way, the Arduino SoftwareSerial Library you linked to might work with the 3pi if you program it using the Arduino IDE. You can read more about programming the 3pi from the Arduino IDE in this guide.
Thank you for your help! I will look into it.