Pololu PGM02B USB programmer - BASCOM BASIC

Okay… I’m not having any luck here… and I was hoping to create a programming kit based around this USB programmer.

  1. I got a 3pi robot.
  2. I have a Pololu PGM02B USB programmer, the jumper is in the “P” location.
  3. The driver is downloaded and installed.
  4. Power on the robot is ON.
  5. The programmer has a GREEN LED illuminated.
  6. Windows shows the Pololu programmer as being COM3
  7. I opened BASCOM… here is the “about” screen.
Compiler version :1.11.9.1
Compiler build   :1.11.9.1.001
IDE version      :1.11.9.1
Serial number    :MC-9907-00151
Windows OS       :Microsoft Windows 2000
Windows SP       :Service Pack 4
Explorer         :6.0.2800.1106
Windows dir      :C:\WINNT
App data dir     :C:\Documents and Settings\Administrator\Application Data
System dir       :C:\WINNT\system32

I set the programmer as…
Type: “AVR ISP Programmer
Com Port: COM3
BAUD: 57600 also tried 9600 and 19200, no help.

I have also tried…

  • STK 500
  • USB ISP Programmer
  • MCS USB Programmer

None of them worked either.

I hit manual program… it says it can’t find the chip.
I hit “IDENTIFY CHIP”, no good.
I hit the button to query the lock and fuse bits… nothing.

So now what?
Jerry

The Pololu USB Programmer runs at 115.2 kbaud, so you should try connecting at that speed. If that doesn’t work, let us know what the lights on the programmer are doing during programming, and also try it with AVR Studio’s AVRISP programming software.

I tried that.

I plug in the programmer, I get a green LED and a flashing red LED.
I turn the power to the robot ON and the red led stops, turns off.

Now I have only a green LED on the programmer.

When I attempt to program, there is no change on the programmer… no blinking, nothing.

I’m certain I have the settings right… see for yourself…
(video link removed)

Jerry

In the video, the BASCOM programmer says “213 bytes read” and “chip type not found”. There is some incorrect information about an ATmega168 in the dialog box, but the chip is set to AT90S1200. Is ATmega168 an option?

I’m not sure what is going on, but it seems like BASCOM might not support the mega168. Have you successfully used BASCOM to program a mega168 chip before? Do the lights on the programmer flash briefly when you click “Identify chip”? The “213 bytes read” message seems like a good sign - when did that appear?

It would also be helpful for you to install AVR Studio or WinAVR with avrdude, so that we can make sure the 3pi is working in the normal way before trying BASCOM.

The software defaults to the AT90S1200 as it is the first one on the drop down list. I have used the BASCOM for the Mega 168 with no problem at all. I was using the “simple programmer” which is four resistors and a capacitor connected to the parallel port. I have also used a serial programmer via Pony Prog which works but it is slower and it is another download for an end user.

My goal is to make an educational package that can start the user off with a simple blinking LED, then migrate up to all the robotic functions. Unfortunately new computers are released without a parallel port so I am forced to go to the USB option.

I was hoping to find a plug-n-play version that could be simply installed and then used by a simple type selection from the drop down menu. BASCOM sells one, but it’s about $45 or so… I was looking to get the best deal. Not ready to give up on this one yet… just getting frustrated.

When I hit the program or the chip identify buttons I am not seeing any change on the programmer. As I said in the post above, I get a solid green led after I turn the unit on, nothing more until I turn the unit off, at which time I get a flashing red LED. (It could happen so fast that I don’t detect it… not sure.)

If I use my homemade parallel programmer on a Mega 168 in a breadboard… no problem. But I need to make sure any users will be able to duplicate my efforts… and so far, I am not having any luck. If I get a chance to go by my storage unit I can pick up my other electronic parts and get the parallel programmer I made for the 6 pin ISP to try the 3pi. (I’m getting ready to move so my stuff is packed… I bought this combination so I would have something to occupy my time while in transit… selling the house, etc.)

I may hand the unit off to one of our other members robomo.com to see if they have any luck… I didn’t expect it to be this difficult to get started. I’ll download either AVR Studio or WinAVR but I really have zero background with C, so not sure how I’ll do.

Jerry

I’ve got a copy of the demo version of BASCOM installed on my Windows Vista computer now. I’m trying to get it working, but so far have had no luck. I’ll post again with some more information after I figure out what is going on. It’s possible that BASCOM is not compatible with the Pololu programmer, but if so, we’d like to know why.

I’m recommending you try avrdude or the AVRISP that’s part of AVR Studio, just to load your hex files onto the robot. You don’t have to program in C to use those programs, so don’t worry :slight_smile: That would let you get started programming and reassure you that your 3pi/programmer combo works, while we try to figure out what the issue is with the BASCOM programmer.

Okay great.

I’ve never had any issues with Bascom before… I have used it to teach students because it is very simple to work with. Literally You can make something as easy as…

config portb = output
LED alias portb.0
do
toggle led
wait 1
loop

And have a blinky LED… so I have taught people as young as seven how to program with it. The last time I tried to use a C compiler it had many different screens, lists of include files… didn’t know where to start. I admit that I need to learn it… just for now I wanted to keep it simple.

I sent Mark Alberts [ mark(at)mcselec(dot)com ] (author of BASCOM) a link to this forum and told him about the issue as well… I am hoping to get it resolved soon.

Update: I downloaded AVR Studio… it reads the 3pi and saves the file just fine. I pointed it to the HEX file I created with BASCOM and it loaded that just fine too. Like you said… it’s an issue with BASCOM. At least I can work with it now… that is much less fustrating even if I do need to go between programs. (I may even break down and learn AVR Studio.) :sunglasses:

Jerry

I got a reply from Mark at BASCOM…

So it looks like I use AVR Studio to program the HEX files.
Jerry

That explanation makes sense. Any idea when they’ll release the next version of the IDE?

I’m thinking within the next couple of months… but I have seen Mark go a year with no updates, then have three in a two month period. It all depends on what he has going on at the time.

Jerry

I’ve installed BASCOM on my new VISTA box.

BASCOM is not capable of programming anything with the Vista box.

On the 1.11.9.5 verson, I cannot program with the MarkII ISP (USB)from ATMEL, the STK200/300 or the stk500 command line version utility. It may look nice, but it doesn’t work.

This makes it very inconvenient to use because the hex file has to be loaded from the AVRStudio 4 flash tool to download it to the target board.

I’ve emailed BASCOM software writer and he has not been of any help more than my own trouble-shooting in resolving the issue.

I’ve still to hear back from him on why it doesn’t work with even the standard basic programmer that I was using before.

If I try it on my XP box, everything is fine. I think there is a serious bug in BASCOM that has incapacitated any downloading of a hex file while BASCOM is running with VISTA.

It’s now 2010, I got my Pololu 3pi robot out of storage, connected it to a brand new PGM02B Pololu USB programmer… loaded the USB driver, loaded the most recent version of BASCOM… 1.11.9.8 and went through just about every combination of USB programmers I could find. Not one worked.

Running a Dell Latitude with Windows XP now… no parallel port, so I can’t use my simple programmer any more.

Very disappointing… off to load AVR Studio on this machine and try it that way again.

Okay… have the current driver, downloaded the patch pgm02b_firmware_v1.4.pgm from the web page, and I downloaded AVR Studio 4…

AVR Studio		4.18.700  
GUI Version		4, 18, 0, 685
AVR Simulator 2		
ATmega168		201

Operating System
Major			5
Minor			1
PlatformID		2
Build			2600
Service Pack 3

Plugins:

AvrPluginAvrAsmObject	1, 0, 0, 48
AvrPluginavrgccplugin	1, 0, 0, 11
Stk500Dll			1, 0, 1, 15

I opened the HEX file that was created with BASCOM… it appears to load okay… I see a screen with dissasembler data in it… so I next click on TOOLS --> PROGRAM AVR

I get “CONNECT FAILED - SELECT AVR PROGRAMMER”

The items listed are…

  • AVR ONE!
  • STK600
  • QT600
  • AVRISP mkII
  • STK500
  • JTAGICE mkII
  • AVR Dragon
  • AVRISP
  • JTAGICE

I tried clicking on the driver update… pgm02b_firmware_v1.4.pgm but windows has no idea what to do with it, nor do I. How do I make the update? How do I connect with the programmer?

I have tried several items from the list… not getting ANYWHERE… very frustrated.

Would someone PLEASE give me some simple steps to program this 3PI before I throw it at the wall?

Jerry

Hello.

You can find instructions for updating your programmer firmware in section 8 of the programmer user’s guide (the file you’re talking about is not a driver, it’s a firmware update). I recommend you read through the user’s guide (especially the troubleshooting section). It sounds like the problem is entirely with your ability to communicate with the programmer, not the 3pi. Can you try talking to the programmer with a different application, such as AVRDUDE or AVR Studio? We don’t have any experience with BASCOM, so we can’t really help you very much with it.

- Ben

I finally got it!

  1. I had to reinstall the driver for W2K on this XP machine, the original diver was showing errors.
  2. I went to device manager and set the baud to 115200, 8 bit 1 stop bit, no parity (It was 9600 BAUD)
  3. I downloaded Tera Term and set it up for the same serial settings. (115200, 8 bit 1 stop bit, no parity)
  4. I had to do a firmware upgrade… very tricky… took about 5 tries to get the timing.
    Loaded: pgm02b_firmware_v1.4.pgm
  5. I had to select STK500 NATIVE programmer from within BASCOM
  6. I selected USB.
  7. Told it to identify chip - Worked
  8. Told it to program chip - Locked up - See workaround below.

Put in this code…

'---------------------------------------------------------------
' Name:  Hello World
' Micro: Mega 168
'---------------------------------------------------------------
' Fuse Bits as read by the programmer via BASCOM
$prog &HFF , &HF6 , &HDC , &HF9

Config Lcdpin = Pin , Db4 = Portb.1 , Db5 = Portb.4 , Db6 = Portb.5 , Db7 = Portd.7 , E = Portd.4 , Rs = Portd.2
Config Lcd = 16 * 2

Begin:
Cls
Wait 1
Lcd "Hello"
Lowerline
Lcd "World"
Wait 1
Goto Begin

Interesting note with BASCOM… normally you just click PROGRAM and it will automatically identify, erase, and program the chip. It was locking up when I did that. I have Mark looking at BASCOM on that now.

The workaround…

  1. Click MANUAL PROGRAM
  2. Click IDENTIFY CHIP, in 0.5 seconds it will say “Mega 168”
  3. Click WRITE CHIP and it will do so in a second or two.

I got the following email from Mark at mcselec.com/ (BASCOM)

Yippie!
Jerry

Addendum: Mark (Bascom) came back with a modified version where he added code to tell the unit to go into program mode before each command. This works every time now.

Mark at mcselec.com/ (BASCOM) wrote:

The pololu programmer firmware is not programmed according to the stk500V2 protocol standard.
After enabeling the programmer, the programmer must remain enabled until the programmer is disabled.

For an explanation of why our programmer behaves differently than the STK500, see this post:

-David

I have since learned some more helpful tidbits…

BASCOM sets the ISP frequency too high to program a chip if it has the internal divide by 8 counter active… some come from the factory with it turned on.

The patch is to go into AVR Studio and set the programmer frequency to 57.60 KHz.

Once you do that… go to BASCOM and under programmer there is a check box to NOT send the ISP frequency… be sure it is checked. This will prevent BASCOM from setting it too high. Once that is accomplished… programming should work just fine.

Here is the related topic area…

And here is what my setting screen looks like…

Jerry

Hello.

Thanks for the tip!

- Jan