Using a bootloader with a 16F88, (almost) under Linux

Replacing the 16F1628 with a 16F88, that’s the next “main” step for the SirBot Project. One of the most interesting feature is the possibility to use a bootloader to self-program the chip. This prevents unplug/plug the chip from the board to the programmer, it’s way faster and, most importantly for me, this seems to be the only way to program my chips using a USB-to-serial converter, since my PIC01 programmer (as many JDM) can’t work with it . This is (IIRC my investigation) due to voltage differences: a programmer needs 12V, it can only have 5V from USB. Anyway, it can’t work and since my laptop doesn’t have any serial port, this is for me the only alternative (yes, I have a serial port on my desktop PC, but it’s not my main PC).

So, in this context, a bootloader must  be able to :

  • program my chips through the USB-to-serial converter
  • work under Linux (plaftorm independent)
  • easily integrate within the SirBot Project (if possible)
I first tried Bloader and its screamer. What I liked is the little program which blinks LEDs connected to any ports and send “Ok” through the serial link. This is helpful to ensure everything is ready. But… I couldn’t make it work using wine. I just got a “Error: type mismatch”, followed by the meaningful alert message: “13″. I tried different baudrates but always the same error.

I did not try further and switch to Tiny Bootloader. This bootloader seems to work fine with 16F88 and with Jal. More,a python script, pytbl, is available to use it: this is a great opportunity to use it within SirBot. So, let’s go… I’ve first flashed the 20MHz/115200bds hex file with my programmer. Using wine, I’m able to detect my 16F88 but… still unable to write the flash (“Could not write… Error…”). However, it works like a charm with a “real” serial port (%*$%%µ! converter). During my Bloader/Screamer exploration, it was mentioned that the baudrate configuration (9600, …, 115200) was useful when a usb-to-serial converter was involved… Heh ? Sounds interesting ! I thought: “if you took that asm file, modify it to use 20MHz xtal and 9600bds, compile the whole and put it in your 16F88, there will be a magical moment, for sure…”. And I did it… But no magical moment occured, still the same error. Ah, yes, I can remember the magical moment. It was when I compiled the asm file with MPLAB (crap, gpasm failed). It said “The file path [to the asm file] mustn’t be longer than 62 characters”…

Then I had the great idea: using VirtualBox, I’m able to run XP under Linux, attach my usb-to-serial converter, then launch TinyBootloader, then program my 16F88, then have my magical moment…

Now, what about pytbl ? It can detect the chip, but when it programs it (without errors), nothing is working anymore, even the bootloader… I’ve contacted the authort, so more on this later (I hope).


Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>