Write speed to flash

Any general or miscellaneous queries that do not fit into the other forum catagories

Moderators: Benj, Mods

Post Reply
Ron
Posts: 225
Joined: Wed Apr 11, 2007 6:15 pm
Has thanked: 2 times
Contact:

Write speed to flash

Post by Ron »

Hi,

I am using a bootloader and when downloading a small flowcode program (blink a single LED on/off) using loop block it takes almost 5 seconds at 9600 baud.

I have the source code and recompiled PC application and Bootloader for 115.2K . It still takes the same amount of time to download the small program. Is this normal or does it sound like the bootloader code is not well written?

Thanks

Ron

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: Write speed to flash

Post by Benj »

Hello Ron

Congratulation on the bootloader code.

Sounds like there is a bottleneck somewhere in your application. Maybe on the windows side.

If the PIC side of the bootloader was failing at high speed then data would probably be lost and your program would not run correctly.
However if the PC side of the bootloader had delays or runs off a timer etc then the new higher baud rate would not effect the actual throughput of the system.

Ron
Posts: 225
Joined: Wed Apr 11, 2007 6:15 pm
Has thanked: 2 times
Contact:

Re: Write speed to flash

Post by Ron »

Hi,

The code runs fine on the PIC, best as I can tell. If I try the PC app set for 9600 and PIC for 115.2k they do not connect (which is what I would expect), the same is true for 115.2 PC App and 9600 PIC.

When both are set for 9600 everything appears to run fine, same at 115.2K.

I am not a C# programmer, I will try to find someone that can look at the PC application to see if there is some kind of a delay somewhere in the code.

Thank you,

Ron

Ron
Posts: 225
Joined: Wed Apr 11, 2007 6:15 pm
Has thanked: 2 times
Contact:

Re: Write speed to flash

Post by Ron »

Hi Ben,

I have used a serial port monitor to try to see if my windows app is the bottleneck in downloading a program to a pic via serial port.

The windows program does not appear to be the issue.

I get a .0156 second time delay when sending data to the PIC and receiving a responce. This is the same amount of time at 9600 or 115200 baud.

This tells me the longest delay is in the pic, while writing to memory I expect.

I am using a 16F887 (8K). Flowocde tells me the progrm uses 35% of memory or approx. 2.8K. It takes about 1 minute and 50 seconds do send this program to the PIC without any form of verification. Maybe I will find the money to have this improved at some future date.

How long should it take to write 2.8K program to a PIC via serial port? at 115.2K more than couple of seconds seems to high to me. Unless writing to Flash is a very slow process.

Does all the above sound logical, am I thinking this out correctly?

Thanks

Ron

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: Write speed to flash

Post by Benj »

Hi Ron

What speed is your 887 running at? Maybe upping the clock for the device may help.

Also using an 18F USB device you would be able to run the device at a max clock of 48MHz instead of 20MHz. You could even use the USB to host your serial commuications.

Other then this I would suggest looking at your PIC program and seeing if anything can be made more efficient or improved. Eg if there are any lengthy calculations or delays or timeouts etc that may be causing the slow rate you are experiencing.

Ron
Posts: 225
Joined: Wed Apr 11, 2007 6:15 pm
Has thanked: 2 times
Contact:

Re: Write speed to flash

Post by Ron »

Hi Ben,

I am running 16F887 at 20MHz. I have never used any other bootloader, am I right in thinking it is taking to long to write this small a program?

If I have the baud rate set at 115.2kbps can you give me an estimate of how long it should take to write a 2.8k program to a pic.

I need a bench mark, is there anything in a data sheet that says how long it takes per write.

I am going to try to hire someone to work on a few more features in my bootloader and fix one bug at the same time. I am trying to determine if this slow writing is typical or should I add it to the list of items to improve on. If the write time is typical then no reason to add it to the list.

I had this written specifically to work with flowcode and am hoping to have a "good" quality program in the end. The download time is really bothering me, if you had not noticed.


Thanks

Ron

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: Write speed to flash

Post by Benj »

Hello Ron

Yes if your program is taking over a minute to program 2.8K of data then there is a problem somewhere. Our PPP software would take a few of seconds to transfer that amount of data.

If the bootloader works at the end of the day then depending on how often you use it will depend on how much faster you need it to be.

Writing flash memory is very fast and should not be causing the major delays you are experiencing. I would assume a comms timeout or something similar is responsible for the slow speed.

Post Reply