Problem with Serial Communication b/w PC and 3pi

Hello,

I’ve been working with the 3pi for a few weeks now without problems and I’ve been having lots of fun. The project I’ve now started working on requires that I gather some IR sensor data from the 3pi serially, so I can graph it on my computer. Unfortunately, either my PC isn’t receiving the data or my 3pi isn’t transmitting. I’m running Windows 7 and to the best of my knowledge, all of the Pololu USB AVR Programmer (which I am using) drivers have been successfully installed. Here’s what I know and what I’ve tried.

  • Identified the TTL Serial Port as “COM5”
  • Using a baudrate of 9600
  • Neither puTTY nor the Pololu Serial Transmitter v1.3 receive any serial data from my program (which is below this list), using the settings described above
  • Sending the 0x81 byte via the PST does not generate a response
  • I am using version 1.07 of the USB AVR Programmer firmware

I’ve simplified the code I am using to the following (which I have tested without success).

	char *message = "hello\r\n";
	serial_set_baud_rate(9600);

	while(1)
	{
		serial_send(message, 7);
		play(BUTTON_SWITCH);       // just a constant I've defined elsewhere
		delay_ms(1000);
	}

I’m totally baffled why this doesn’t work, and I can’t seem to find a solution. Could someone give me a hand?

Thanks,
Geoff

Hello, Geoff.

I’m sorry you are having trouble. Did you connect the programmer’s RX and TX serial lines to the 3pi?

–David

Ah, I didn’t realize I had to do this. I actually have the PGM03A, so there is no jumper for switching between programmer or USB-to-serial mode. I take it all I have to do is connect the TX and RX lines from the PGM03A to the PD0 and PD1 pins on my 3pi, respectively? What is the easiest way to do this?

Your proposed connections are correct, but you also need to make sure the programmer’s GND is connected to the 3pi’s GND. The GND is part of the 6-pin ISP cable so if you just leave the cable plugged in, that is sufficient.

There are several ways you can make the physical connection. I would use a male-male jumper wire:
pololu.com/catalog/category/68

You’ll need to solder a connector of some sort to the 3pi’s PD0 and PD1 lines. I recommend using a 1x2 Female Header or getting the 3pi Expansion Kit Hardware.

You’ll also need to solder a 1x6 female header to the programmer.

–David

Gotcha. Thanks!

Hi there!

I’m using PGM02B. May i know what is the purpose to connect RX and TX line? We must connect it in order to programme he 3pi Pololu?

Currently i tried to load the programme to 3pi but it seems nothing happened. Could you please help me on this?


Besides,

I found out AVRISP mkII programmer on the internet. We need that to programme our 3pi?

Currently i’m just having PGM02B and a 3pi Pololu (328P).

Ben

Hi Ben,

The PGM02B is sufficient; this is all you need to program the 3pi.

The purpose of connecting the RX and TX lines from the programmer to the robot is just for serial communication (which is not needed to program the robot).

What happens when you try to program your robot, exactly?

Also, I believe the following #include is necessary to put data into program space:

#include <avr/pgmspace.h>

Thanks,
Geoff

Hi Geoff,

thanks a lot for helping! i did include the library header but it just not working.

I would like to ask for the “Tool”, i should select “STK500” or “AVR Simulator”?

Thanks
Ben


Hi,

after i debug the programme, it comes out the error:

[ERROR] No address to source mapping in object file., ModuleName: TCF (TCF command: StackTrace:getChildren failed.)

What does it means?

Thanks,
Ben

The USB AVR Programmer’s Guide indicates that you should select “STK500” to program the robot, I believe. Is this what you tried before? I noticed in your screenshots that you selected the “AVR Simulator”.

I’m not sure what that means. Perhaps one of the Pololu employees could lend a hand here…

Thanks Geoff for helping!

Hi there,

From https://www.pololu.com/docs/0J6/all, it stated that The platform should be AVRISP. But then i still facing the problem as stated in my previous post, anyone could give me advice on this?

Thanks,
Ben

Hello.

Could you please tell me exactly what steps you did that caused the error message? What version of AVR Studio do you have? What files did you open and what buttons did you click? Any other information you have about what you did could be useful too.

–David

Hi David,

Before that, i updated the firmware but seems nth happened. The REV number is still 0100 although i updated to pgm02b_firmware_v1.4.pgm as u taught me in the other post.
https://www.pololu.com/docs/0J6/all#8


I’m using AVR Studio 5.1 and followed all instruction stated in
https://www.pololu.com/docs/0J51/all#3

I opened the program 3pi_app1,

#define F_CPU 20000000UL // Orangutan and 3pi frequency (20MHz)
#include <pololu/3pi.h>
#include <avr/pgmspace.h>
#include <avr/eeprom.h>

int main()
{
	play_from_program_space(PSTR(">g32>>c32"));  // Play welcoming notes.

	while(1)
	{
		// Print battery voltage (in mV) on the LCD.
		clear();
		print_long(read_battery_millivolts_3pi());

		red_led(1);     // Turn on the red LED.
		delay_ms(200);  // Wait for 200 ms.

		red_led(0);     // Turn off the red LED.
		delay_ms(200);  // Wait for 200 ms.
	}
	return 0;
}

Build it, Clicked the AVR Programming button, select “SDK500”, select “ISP”, an Error occured after i clicked “Apply”,


If i select “AVR Simulator”, “ISP”, clicked “Apply”, “Read” Device ID, clicked “Memories”, select Hex file, and “Program”.


The Green LED dim a little bit(not bright as in the Demo program initially loaded) instead of the Red LED. Besides, i try to erase by clicking “Erase now” but nth happen.

I really need a hand. Please do help me on this David. Thanks a lot!!!

Ben

Hello, Ben.

Thank you for the information. Please understand that we have two types of AVR programmers:

New (2009): pololu.com/catalog/product/1300
Old: pololu.com/catalog/product/740

You have the older one which is called the “Orangutan USB Programmer”. The document you linked to (the Pololu AVR Programming Quick Start Guide) does NOT support the older programmer. In fact, the older programmer will not work with AVR Studio 5 at all.

–David

Thanks a lot for your reply David!

So that’s mean after I replace the programmer with the one you suggest should solve all the problems?

I’m using Window 7 32bits, AVRStudio 5.1, 3pi Pololu ATmega328p.

Thank you! ^^

Ben

Yes, it would.

–David

Thank David!!

Besides, before i’m getting the Pololu Programmer tomorrow, i have some doubt reading through the documents in Pololu USB AVR Programmer User’s Guide.

In upgrading the firmware section, it stated that “Get your programmer into bootloader mode”, “this can be done by clicking the “Start Bootloader” button in the lower left corner of the configuration utility.” What does the configuration utility means?

The Pololu USB AVR Programmer Configuration Utility is a free piece of software you can download from our website. You can find it in the “Installing Windows Drivers and Software” section of the user’s guide and there is a screenshot of it in the “Configuring the Programmer” section.

–David