Using Flowcode with the TINY PIC Bootloader

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Using Flowcode with the TINY PIC Bootloader

Post by Benj »

Hello

Flowcode can use the TINY PIC Bootloader developed by Claudiu Chiculita to program PICmicro chips via a RS232 serial connection.

Supported 16F PICmicro devices
87, 88, 873, 873A, 874, 874A, 876, 876A, 877, 877A

Supported 18F PICmicro devices
452, 242, 442, 2420, 2520, 4420, 4520, 458, 248, 448, 2480, 2580, 4480, 4580, 4620, 2525, 4525
1220, 2220, 2320, 6520, 8520, 6620, 8620, 6720, 6621, 4550, 2455, 4455, 2331, 2431, 4331, 2585, 2680, 4585
2480, 2580, 4480, 2525, 2620, 4525, 2220, 2320, 4220

Firstly download the project files from here.
http://www.etc.ugal.ro/cchiculita/softw ... loader.htm

Then download the correct hex file to the chip using PPP, PICkit or your preferred programming tool. Make sure you are using a 20MHz crystal and also set the configuration in PPP to HS oscillator mode, Watchdog off, LVP Off.

Once this has been done the bootloader is present on the PICmicro device. You can test the bootloader operation by loading the "tinybldWin.exe" file located in the download, selecting the correct COM port, connecting a RS232 cable between the UART and the COM port with adequate voltage shifting properties (MAX232 chip or some designs just use resistors and diodes) and clicking CheckPIC. The baud rate to use is specified in the name of the hex file that was programmed onto the PICmicro.

If the PICmicro device is detected then the software reports "Found: 16F 88" as an example.

Flowcode programs can be compiled and then the bootloader software can be used to transfer the hex file onto the chip.

Alternatively by clicking on Chip -> Compiler options in Flowcode you can specify that Flowcode uses the TINY Bootloader programmer directly.

Set the Programmer Location to point to the "tinybldWin.exe" programming file.
Eg: C:\TinyBootloader\tinybldWin.exe

Set the Programmer parameters to: "%f.hex"

Now when clicking the compile to chip button, Flowcode will trigger the TINY Bootloader software and start the programming process. You must manually restart the chip before the programming timeout is reached for the chip to be detected and programming to complete successfully.

Gou16F
Posts: 1
Joined: Wed May 21, 2008 11:16 pm
Contact:

Re: Using Flowcode with the TINY PIC Bootloader

Post by Gou16F »

Hi Benj, I think that you must have an interrupt enable to use tinyBL.
If not, code compiled by boostC will be written at the beginning of the program memory, BEFORE the interrupt vector (04h). For example:

Code: Select all

...some declarations
delay_s_00000_arg_del            EQU	0x00000021 ; bytes:1
	ORG 0x00000000
	clrf    PCLATH          ; Effacer sΓ©lecteur de pages
	GOTO	_startup
	ORG 0x00000003
delay_ms_00000
; { delay_ms ; function begin
	MOVF delay_ms_00000_arg_del, F
	BTFSS STATUS,Z
Here we can see the beginning of the function takes place Γ  03h. Tiny will take the four first bytes and copy theses bytes at high end memory, supposing (as Microchip), that the four bytes are typically something like that:

Code: Select all

	org 0x000 		  ; Starting adress
	clrf    PCLATH           ; clear page selection
  	goto    init		    ; Go to main
        nop
        nop
	org 0x004		   ; Interrupt vector
	movwf   w_temp        ; save W
	swapf	STATUS,w      ;
In the second case, tiny can copy the four first bytes at the end of the bootloader, and replace by his own goto "bootloader". At the end of the boot process, main program is pointed by the 4 original bytes, just copied. In the first case, we can see that beginning of the function "delay_ms_00000" will be non reachable after copy.
I think the best solution is to always have at least one interrupt enable to use Tiny Pic Bootloader.
Best regards,
S.Gounelle

User avatar
kissubin
Posts: 2
Joined: Mon Mar 07, 2011 9:49 pm
Location: Bankok,Thailand
Contact:

Re: Using Flowcode with the TINY PIC Bootloader

Post by kissubin »

It still works today ?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Using Flowcode with the TINY PIC Bootloader

Post by Benj »

Hello,

Yes this still works in v3 and v4.

dickcheung
Posts: 10
Joined: Sun Jun 26, 2011 4:19 pm
Contact:

Re: Using Flowcode with the TINY PIC Bootloader

Post by dickcheung »

Dear Benj,
I am new to this, actually, I have my own programmer that allow downloaded the files to different chips. I simply tried to generate files from flowcode, and then downloaded the file to a new PIC chip (877A without any bootloader) throught that universal programmer (not through flowcode), but failed to run the program, I understand this due to the bootloader has doing some initiallization or jumping, so that the program can't be run properly.

So, is there any method that can be simply using the files generted from flowcode and then download to the chips using 3rd party programmer? (not connected to flowcode). Otherwise, I need to stick on the ECIO forever, ( I wonder why some pins are grouped together, I need to seperated them but control at the same time), I need more flexible method to control the chips.

Thanks so much.
Dick

Benj wrote:Hello,

Yes this still works in v3 and v4.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Using Flowcode with the TINY PIC Bootloader

Post by Benj »

Hello Dick,
So, is there any method that can be simply using the files generted from flowcode and then download to the chips using 3rd party programmer?
Flowcode generates a hex file which can be loaded onto a matrix product using the PPP software or can be loaded onto a 3rd party device, there is no difference between the two.

The only time Flowcode will generate a bootloader offset in the hex file is when the target type in the project options has been set to a specific hardware platform such as an ECIO rather then the raw IC such as the 18F4455.

If you have the chip selected as your target chip then my guess would be that the configuration and or clock speed are not defined correctly for your hardware. If you like you can post up your Flowcode file and specify your hardware details such as oscillator type and speed then we should be able to help get you up and running.

dickcheung
Posts: 10
Joined: Sun Jun 26, 2011 4:19 pm
Contact:

Re: Using Flowcode with the TINY PIC Bootloader

Post by dickcheung »

Dear Benj,
OK, thanks so much :D , I will try this later on as not in my desk. Maybe last time I selected ECIO instead of real chip :oops: .

Thanks again.
Dick
Benj wrote:Hello Dick,
So, is there any method that can be simply using the files generted from flowcode and then download to the chips using 3rd party programmer?
Flowcode generates a hex file which can be loaded onto a matrix product using the PPP software or can be loaded onto a 3rd party device, there is no difference between the two.

The only time Flowcode will generate a bootloader offset in the hex file is when the target type in the project options has been set to a specific hardware platform such as an ECIO rather then the raw IC such as the 18F4455.

If you have the chip selected as your target chip then my guess would be that the configuration and or clock speed are not defined correctly for your hardware. If you like you can post up your Flowcode file and specify your hardware details such as oscillator type and speed then we should be able to help get you up and running.

Post Reply