Bootloader on 18F2550

109 views
Skip to first unread message

Sebastien Lelong

unread,
Aug 3, 2009, 3:15:40 PM8/3/09
to jal...@googlegroups.com
Hi guys,

I'm trying to prototype few things with a 18F2550. I've bought a FDTI USB-to-serial converter, and would like to use a bootloader. So far, using XWisp, I've been able to blink a LED, and use serial/echo. I programmed my chip with a Tinybootloader for 18F2550 (included TinyBld18F4550_20Mhz_115200.hex). When I upload the same sample using tiny, it reports the upload is ok, but then nothing happens (no blink). I did not forget to use -long-start this time...

Any idea why it doesn't work ?

Thanks
Seb

jalv24lbeta -long-start  -s ../include/device 18f2550_blink.jal
jal 2.4l-beta (compiled Jul 28 2009)
generating p-code
0 errors, 0 warnings
9159 tokens, 86588 chars; 1883 lines; 2 files
live variable analysis iterations: 1
generating PIC code pass 1
generating PIC code pass 2
writing result
Code area: 93 of 16384 used
Data area: 3 of 928 used
Software stack available: 925 bytes
Hardware stack depth 0 of 31



--
Sébastien Lelong
http://www.sirloon.net
http://sirbot.org
18f2550_blink.jal
18f2550_blink.asm

a.faber

unread,
Aug 3, 2009, 3:51:27 PM8/3/09
to jal...@googlegroups.com
Hi Seb,
Not a solution, what I did in the past to analyse these kind of problems, is
after the download with the bootloader, readout the entire flash and config
with a ICSP (e.g. XWISP) and save the hex file, analyze
the hex file in MPLAB by importing and using the building dissassembler.
Albert
Sbastien Lelong
http://www.sirloon.net
http://sirbot.org



Sebastien Lelong

unread,
Aug 9, 2009, 6:09:31 AM8/9/09
to jal...@googlegroups.com
Hi,

Sorry to bother, but can I find this disassambler option in MPLAB IDE ? I've searched everywhere...

Thanks
Seb
--
Sébastien Lelong
http://www.sirloon.net
http://sirbot.org


2009/8/3 a.faber <a.f...@chello.nl>

funlw65

unread,
Aug 9, 2009, 1:51:05 PM8/9/09
to jallib
For 18F2550 I'm interested in bootloader used for 18f14k50 but without
the need of start button (autorun after 5 seconds by example).

Sebastien Lelong

unread,
Aug 9, 2009, 2:05:06 PM8/9/09
to jal...@googlegroups.com
Hi guys,

OK. It appears the problem comes from my Linux tinybootloader client. Seems not working with 18F devices. I've successfully  programmed a blink-a-led using original Windows version.

So... is there anybody here who has a Linux (or cross-platform version) of a Tiny client ? (Rob, I remember you sometime talked about this, did I dream or will you save my WE ?...)

Cheers,
Seb
2009/8/3 Sebastien Lelong <sebastie...@gmail.com>

AlbertF

unread,
Aug 9, 2009, 2:22:58 PM8/9/09
to jallib
Hi Seb,
Star

On 9 aug, 12:09, Sebastien Lelong <sebastien.lel...@gmail.com> wrote:
> Hi,
>
> Sorry to bother, but can I find this disassambler option in MPLAB IDE ? I've
> searched everywhere...
>
> Thanks
> Seb
> --
> Sébastien Lelonghttp://www.sirloon.nethttp://sirbot.org
>
> 2009/8/3 a.faber <a.fa...@chello.nl>

AlbertF

unread,
Aug 9, 2009, 2:24:45 PM8/9/09
to jallib
Hi Seb
Start MPLAB
File/Import -> select HEX file
View/Program Memory
At the bottom are 3 tabs, select the Symbolic tab
Albert


On 9 aug, 12:09, Sebastien Lelong <sebastien.lel...@gmail.com> wrote:
> Hi,
>
> Sorry to bother, but can I find this disassambler option in MPLAB IDE ? I've
> searched everywhere...
>
> Thanks
> Seb
> --
> Sébastien Lelonghttp://www.sirloon.nethttp://sirbot.org
>
> 2009/8/3 a.faber <a.fa...@chello.nl>
>
>
>
>
>

Rob Hamerling

unread,
Aug 9, 2009, 2:31:36 PM8/9/09
to jal...@googlegroups.com

Hi Seb,

Sebastien Lelong wrote:
>
> OK. It appears the problem comes from my Linux tinybootloader client. Seems
> not working with 18F devices. I've successfully programmed a blink-a-led
> using original Windows version.
>
> So... is there anybody here who has a Linux (or cross-platform version) of a
> Tiny client ? (Rob, I remember you sometime talked about this, did I dream
> or will you save my WE ?...)

I'm afraid not. I have indeed written a (commandline) TinyBootLoader
client for some specific PICs (16F88 and 16F886). It is written with
support for eCS, Linux and W32 (like Xwisp2), but I have not tested it
with Linux yet. More importantly for you it does not support any 18F!
I could send you the C-source, but since it is not table-driven it will
probably take you a lot of time to adapt it for the 18F.

Why not ask the author of your Linux client to check/fix the problem?

Regards, Rob

--
Rob Hamerling, Vianen, NL (http://www.robh.nl/)

AlbertF

unread,
Aug 9, 2009, 3:09:51 PM8/9/09
to jallib
Hi Seb,
There is also a sourceforge project, there seems to be a recent
version, don't know if it supports 18f, but
source code is available
http://sourceforge.net/projects/tinybldlin/files/
Albert

AlbertF

unread,
Aug 9, 2009, 3:25:17 PM8/9/09
to jallib
Hi,
The 14k50 USB bootloader can also be compiled for the PIC18f2550,
I can change it to make start automatically, but the challange is the
code size,
will do some experiments later.
Albert

Sebastien Lelong

unread,
Aug 9, 2009, 3:31:38 PM8/9/09
to jal...@googlegroups.com
Hi Albert,

Thanks for the link, I gonna try this.
I used to use pytbl (http://www.cihologramas.com/contrib/pytbl.html). I've also found tinyjpfr (http://jmandon.free.fr/) from the same author as Pinguino ! (looking at the code, there are higly similar portion of code between pytbl and tinyjpfr, the latter seems to be derived from the first... so it's no working too).
2009/8/9 AlbertF <a.f...@chello.nl>

Sebastien Lelong

unread,
Aug 9, 2009, 3:32:46 PM8/9/09
to jal...@googlegroups.com
OK, I'll be happy to test this too !

Seb
2009/8/9 AlbertF <a.f...@chello.nl>

Sebastien Lelong

unread,
Aug 9, 2009, 3:35:45 PM8/9/09
to jal...@googlegroups.com
Woohoo ! It's working ! Great, thanks !
Now I need to "downgrade" it so I can use it from command line and get rid of GUI.
Cool...
2009/8/9 Sebastien Lelong <sebastie...@gmail.com>

Sebastien Lelong

unread,
Aug 10, 2009, 2:33:16 PM8/10/09
to jal...@googlegroups.com
[Albert]
There is also a sourceforge project, there seems to be a recent
version, don't know if it supports 18f, but
source code is available
http://sourceforge.net/projects/tinybldlin/files/
 
[Seb]
 
Woohoo ! It's working ! Great, thanks !
Now I need to "downgrade" it so I can use it from command line and get rid of GUI.


For those who are interested in a command line version of this app (Tiny bootloader for Linux & Co), I've written a python script derived from the original main script, that avoid any GUI. Pure command line for the real tough guys... I can post the files (and will also try to send back changes to author)


Cheers,

a.faber

unread,
Aug 10, 2009, 5:32:33 PM8/10/09
to jal...@googlegroups.com
Hi,
Just added an additional version of the USB bootloader with autostart. It
will autostart if the version number
is not retreived by the host application (PDFSUSB for example).

1) Flash the bios code (I've also uploaded the hex for 18f2550 & 18f4550
(same hex file) in the file section of the google code group list)
2) Plug in the USB connector
3) When you hear the sound that the USB device is recognized, you have to
select the PICDEM USB 0 (boot) from the combo box in the PDFSUSB host
application, this will retreive the version number so to auto-start is
aborted)
4) Flash the user application (use the standard -loader18 -no-fuse flags
when compiling with JALV2 compiler)
5) Hit the execute button within the PDFSUSB application

6) When you unplug the USB connector, and plug it again, it will first
recognize the bootloader, then wait 10 seconds and the bootloader will start
the user application.

At the moment it still a bit clumsy, but this can be greatly improved by
adapting the downloader application on the host side, will look into this
later-on (and also support for other host platforms than Windows)

Albert


----- Original Message -----

funlw65

unread,
Aug 10, 2009, 5:40:05 PM8/10/09
to jallib
This is great! Thank you Albert!

funlw65

unread,
Aug 14, 2009, 5:18:44 AM8/14/09
to jallib


On Aug 11, 12:32 am, "a.faber" <a.fa...@chello.nl> wrote:

> At the moment it still a bit clumsy, but this can be greatly improved by
> adapting the downloader application on the host side, will look into this
> later-on (and also support for other host platforms than Windows)
>
> Albert

Look at Vasco downloader, is written in python and use pyusb. Maybe
you can adapt it...
http://code.google.com/p/vascodownloader

Sebastien Lelong

unread,
Aug 14, 2009, 1:32:46 PM8/14/09
to jal...@googlegroups.com
BTW, Tinybldlin author is rewriting his app using pyGTK (not using wxPython). A command line is also expected. And I hope (and asked) for a "reset through RTS" option too.

Cheers,
2009/8/10 Sebastien Lelong <sebastie...@gmail.com>

a.faber

unread,
Aug 29, 2009, 6:01:41 PM8/29/09
to jal...@googlegroups.com
Thanks for the the Vascoboot tip, but decided to write it from scratch in
python/libusb, uploaded the python source code files to jallib group files.
Albert


----- Original Message -----
From: "funlw65" <fun...@gmail.com>
To: "jallib" <jal...@googlegroups.com>

funlw65

unread,
Aug 29, 2009, 6:34:15 PM8/29/09
to jallib
Well, this is another great news, thank you again!

On Aug 30, 1:01 am, "a.faber" <a.fa...@chello.nl> wrote:
> Thanks for the the Vascoboot tip, but decided to write it from scratch in
> python/libusb, uploaded the python source code files to jallib group files.
> Albert
>
> ----- Original Message -----
> From: "funlw65" <funl...@gmail.com>
> To: "jallib" <jal...@googlegroups.com>
> Sent: Friday, August 14, 2009 11:18 AM
> Subject: [jallib] Re: Bootloader on 18F2550
>
> On Aug 11, 12:32am, "a.faber" <a.fa...@chello.nl> wrote:
>
> > At the moment it still a bit clumsy, but this can be greatly improved by
> > adapting the downloader application on the host side, will look into this
> > later-on (and also support for other host platforms than Windows)
>
> > Albert
>
> Look at Vasco downloader, is written in python and use pyusb. Maybe
> you can adapt it...http://code.google.com/p/vascodownloader

funlw65

unread,
Sep 8, 2009, 9:59:37 AM9/8/09
to jallib
Hi Albert,

Today I burned your bootloader (the one with autostart) and it was
impossible to install the Microchip custom driver in automatic mode on
Vista Basic. It was a weird behavior - device disconnecting/
reconnecting at some intervals! I had to do it manual.

But now is working nice on my board. I did a blink test and now I will
test with usb-cdc driver.

Vasi

On Aug 11, 12:32 am, "a.faber" <a.fa...@chello.nl> wrote:
> Hi,
> Just added an additional version of the USBbootloaderwith autostart. It
> will autostart if the version number
> is not retreived by the host application (PDFSUSB for example).
>
> 1) Flash the bios code (I've also uploaded the hex for 18f2550 & 18f4550
> (same hex file) in the file section of the google code group list)
> 2) Plug in the USB connector
> 3) When you hear the sound that the USB device is recognized, you have to
> select the PICDEM USB 0 (boot) from the combo box in the PDFSUSB host
> application, this will retreive the version number so to auto-start is
> aborted)
> 4) Flash the user application (use the standard -loader18 -no-fuse flags
> when compiling with JALV2 compiler)
> 5) Hit the execute button within the PDFSUSB application
>
> 6) When you unplug the USB connector, and plug it again, it will first
> recognize thebootloader, then wait 10 seconds and thebootloaderwill start
> the user application.
>
> At the moment it still a bit clumsy, but this can be greatly improved by
> adapting the downloader application on the host side, will look into this
> later-on (and also support for other host platforms than Windows)
>
> Albert
>
> ----- Original Message -----
> From: "funlw65" <funl...@gmail.com>
> To: "jallib" <jal...@googlegroups.com>
> Sent: Sunday, August 09, 2009 7:51 PM
> Subject: [jallib] Re:Bootloaderon 18F2550
>
> > For 18F2550 I'm interested inbootloaderused for 18f14k50 but without

funlw65

unread,
Sep 8, 2009, 10:27:52 AM9/8/09
to jallib
And I think the problem is, after 10 seconds, bootloader give the
control to application and is no more detected...

On Sep 8, 4:59 pm, funlw65 <funl...@gmail.com> wrote:
> Hi Albert,
>
> Today I burned yourbootloader(the one with autostart) and it was

a.faber

unread,
Sep 8, 2009, 2:25:48 PM9/8/09
to jal...@googlegroups.com
Hi Vasi
Thanks for the feedback, maybe can add a check if the first three bytes at
location 0x800 are set to 0xFFFFFF (i.e, when no user app is flashed), if
so, then set wait time to inifinite
b.t.w. if you're want to use the Python USBDownloader you have to install
the LibUSB filter driver (on Windows), on Linux it can work right out of the
box.
Albert

----- Original Message -----
From: "funlw65" <fun...@gmail.com>
To: "jallib" <jal...@googlegroups.com>
Sent: Tuesday, September 08, 2009 3:59 PM
Subject: [jallib] Re: Bootloader on 18F2550



Hi Albert,

Today I burned your bootloader (the one with autostart) and it was
impossible to install the Microchip custom driver in automatic mode on
Vista Basic. It was a weird behavior - device disconnecting/
reconnecting at some intervals! I had to do it manual.

But now is working nice on my board. I did a blink test and now I will
test with usb-cdc driver.

Vasi

funlw65

unread,
Sep 8, 2009, 2:50:26 PM9/8/09
to jallib


On Sep 8, 9:25 pm, "a.faber" <a.fa...@chello.nl> wrote:
> Hi Vasi
> Thanks for the feedback,  maybe can add a check if the first three bytes at
> location 0x800 are set to 0xFFFFFF (i.e, when no user app is flashed), if
> so, then set wait time to inifinite
It make sense. When you burn the bootloader for first time, the rest
of flash memory is empty. Then you install the driver and after that,
it does not matter if you have already a program uploaded, your driver
is already installed. When your new bootloader will be ready, I will
remove the driver and start again from zero.

> b.t.w. if you're want to use the Python USBDownloader you have to install
> the LibUSB filter driver (on Windows), on Linux it can work right out of the
> box.
> Albert
Is ok, I know the procedure. And is ok for me to work on command line
and under Linux (until now I tested only Pinguino IDE which can upload
also the program) but I have friends which prefer Windows and an
application with graphical interface (Pdfsusb). For them I tried this
procedure from zero.

Vasi

P.S. An IDE written in python for JAL will be great... and... maybe is
useful if you add on your blogs tips for using your python uploader.

a.faber

unread,
Sep 8, 2009, 3:55:55 PM9/8/09
to jal...@googlegroups.com
Hi Vasi,
Made the changes and committed the files, have to admit that I have not test
it yet (maybe later tonight)

funlw65

unread,
Sep 8, 2009, 4:47:56 PM9/8/09
to jallib
You are fast!
I compiled the file (for 4550) with jalv2 2.4l and jallib 0.4 and I'm
not getting same size. You said inside that file you obtained 2010
space occupied in flash and I'm getting 2030. What compiler options
you use?

jal 2.4l (compiled Aug 7 2009)
0 errors, 0 warnings
live variable analysis iterations: 3
Code area: 2030 of 32768 used (bytes)
Data area: 37 of 928 used
Software stack available: 891 bytes
Hardware stack depth 3 of 31

Vasi

a.faber

unread,
Sep 8, 2009, 4:53:25 PM9/8/09
to jal...@googlegroups.com
Hi,
Just did an update (was reading the incorrect memory), Ì don't specify any
compiler options, there is a pragma in the code to force the CONST_DETECT
optimizer option. Also are you compiling against the latest Jallib USB
libraries and using the latest compiler?
Albert


----- Original Message -----
From: "funlw65" <fun...@gmail.com>
To: "jallib" <jal...@googlegroups.com>
Sent: Tuesday, September 08, 2009 10:47 PM
Subject: [jallib] Re: Bootloader on 18F2550



You are fast!
I compiled the file (for 4550) with jalv2 2.4l and jallib 0.4 and I'm
not getting same size. You said inside that file you obtained 2010
space occupied in flash and I'm getting 2030. What compiler options
you use?

jal 2.4l (compiled Aug 7 2009)
0 errors, 0 warnings
live variable analysis iterations: 3
Code area: 2030 of 32768 used (bytes)
Data area: 37 of 928 used
Software stack available: 891 bytes
Hardware stack depth 3 of 31

Vasi

funlw65

unread,
Sep 8, 2009, 4:58:15 PM9/8/09
to jallib
I'm using the package available for download from jallib code site.

Vasi

On Sep 8, 11:53 pm, "a.faber" <a.fa...@chello.nl> wrote:
> Hi,

funlw65

unread,
Sep 8, 2009, 5:07:02 PM9/8/09
to jallib
Should I download the svn latest version?

On Sep 8, 11:53 pm, "a.faber" <a.fa...@chello.nl> wrote:
> Hi,

a.faber

unread,
Sep 8, 2009, 5:24:38 PM9/8/09
to jal...@googlegroups.com
Yes please give it a try, hopefully you'll get the same hex file, just made
another small update in order to save some bytes (only checking the highest
byte in the user goto function), also i noticed there is a difference
between a pic1814k50 and a pic18f4550 (4 bytes), likely due to a different
register layout, below the compiler output of both:

Compilation line is : D:\pic\projects\jallib_svn\compiler\jalv2.exe -s
D:\pic\projects\jallib_svn\include\device;D:\pic\projects\jallib_svn\include\peripheral\usb;D:\pic\projects\jallib_svn\include\peripheral\i2c;D:\pic\projects\jallib_svn\include\peripheral\usart;D:\pic\projects\jallib_svn\include\jal;D:\pic\projects\jallib_svn\include\external\lcd;D:\pic\projects\jallib_svn\include\peripheral\pwm;D:\pic\projects\jallib_svn\include\peripheral\adc;D:\pic\projects\jallib_svn\include\peripheral\data_eeprom
D:\pic\projects\jallib_svn\sample\18f4550_usb_bootloader_autostart.jal


jal 2.4l (compiled Aug 7 2009)

generating p-code
0 errors, 0 warnings

2587 tokens, 163250 chars; 4541 lines; 5 files


live variable analysis iterations: 3

generating PIC code pass 1
generating PIC code pass 2
writing result

Code area: 2010 of 32768 used (bytes)


Data area: 37 of 928 used
Software stack available: 891 bytes
Hardware stack depth 3 of 31


Compilation line is : D:\pic\projects\jallib_svn\compiler\jalv2.exe -s
D:\pic\projects\jallib_svn\include\device;D:\pic\projects\jallib_svn\include\peripheral\usb;D:\pic\projects\jallib_svn\include\peripheral\i2c;D:\pic\projects\jallib_svn\include\peripheral\usart;D:\pic\projects\jallib_svn\include\jal;D:\pic\projects\jallib_svn\include\external\lcd;D:\pic\projects\jallib_svn\include\peripheral\pwm;D:\pic\projects\jallib_svn\include\peripheral\adc;D:\pic\projects\jallib_svn\include\peripheral\data_eeprom
D:\pic\projects\jallib_svn\sample\18f14k50_usb_bootloader_autostart.jal


jal 2.4l (compiled Aug 7 2009)

generating p-code
0 errors, 0 warnings

2587 tokens, 153954 chars; 4263 lines; 5 files


live variable analysis iterations: 3

generating PIC code pass 1
generating PIC code pass 2
writing result

Code area: 2006 of 16384 used (bytes)
Data area: 37 of 672 used
Software stack available: 379 bytes

funlw65

unread,
Sep 8, 2009, 6:19:04 PM9/8/09
to jallib
After downloading the last svn and merging in a normal jallib pack
directory structure, I did the compilation and got the same results:

jal 2.4l (compiled Aug 7 2009)
generating p-code
0 errors, 0 warnings
2587 tokens, 163250 chars; 4541 lines; 5 files
live variable analysis iterations: 3
generating PIC code pass 1
generating PIC code pass 2
writing result
Code area: 2010 of 32768 used (bytes)
Data area: 37 of 928 used
Software stack available: 891 bytes
Hardware stack depth 3 of 31

Now I must burn it and test.
Vasi

funlw65

unread,
Sep 8, 2009, 7:15:26 PM9/8/09
to jallib
Tested under WinXP Home Edition and automatic driver install is
working fine. Blink LED test is working fine.
I must test it under Windows Vista Basic... should work...

Vasi

On Sep 9, 12:24 am, "a.faber" <a.fa...@chello.nl> wrote:

a.faber

unread,
Sep 8, 2009, 7:19:43 PM9/8/09
to jal...@googlegroups.com
Hi Vasi
Thanks for the feedback, I tested it on Windows XP and it works fine, still
have to check Linux.
Albert

----- Original Message -----
From: "funlw65" <fun...@gmail.com>
To: "jallib" <jal...@googlegroups.com>
Sent: Wednesday, September 09, 2009 1:15 AM
Subject: [jallib] Re: Bootloader on 18F2550



Tested under WinXP Home Edition and automatic driver install is
working fine. Blink LED test is working fine.
I must test it under Windows Vista Basic... should work...

Vasi

funlw65

unread,
Sep 8, 2009, 8:08:52 PM9/8/09
to jallib
Hi Albert,

Working nice under Windows Vista Basic.

Vasi

funlw65

unread,
Sep 8, 2009, 9:03:27 PM9/8/09
to jallib
Is working GREAT under Linux SuSE 11.1 :

vasi@linux-qsad:~/jal/project/FreeJALduino/blink> python ~/
Albert_uploader/UsbBootLoader.py write 18f2550_blink.hex
COMMAND write
FILENAME 18f2550_blink.hex
Waiting for USB PIC bootloader device ...
Boot device version number 1.20
Found PIC: device_id 1240 name 18f2550
Flashing file 18f2550_blink.hex

Blink sample compiled with last svn jallib using Piklab 0.15.4 and
uploaded with UsbBootLoader.py

Vasi

On Sep 9, 2:19 am, "a.faber" <a.fa...@chello.nl> wrote:
Reply all
Reply to author
Forward
0 new messages