CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Writing multiple lines into program memory

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
PIC24H



Joined: 02 Mar 2015
Posts: 19

View user's profile Send private message

Writing multiple lines into program memory
PostPosted: Thu Jul 16, 2015 6:03 am     Reply with quote

Hello. I am using the ex_pcd CCS Bootloader. The bootloader writes line after line into the pic. this takes "a lot" of time. Now I am trying to load about 23 lines, so that it writes a bunch of lines into the program memory at once, so that it dont have to erase and write for each line.

I wrote a routine so that it checks each line in the array to get the checksum etc. I copy all the date of the lines into the data[] Array.

How does the write_program_memory( ) work?
write_program_memory( address, dataptr, count );

I just calculated the address for the first line. As the dataptr the data Array is given. and the count is to total bytes of lines. I cant get it to work :(

Can someone help me?
Ttelmah



Joined: 11 Mar 2010
Posts: 19338

View user's profile Send private message

PostPosted: Thu Jul 16, 2015 7:27 am     Reply with quote

You do understand that existing code does _not_ erase for each line. It only erases on the first write to the bottom of the page.
Trying to write more than FLASH_WRITE_SIZE bytes at a time, will actually make the code slower. The most efficient size to transfer is defined by this value (the number of write latches that the chip has - write this many bytes, and a single transfer will be used). Make your array this size for best operation.
Be prepared for just how slow the memory actually is. On a chip like the 24FJ256, each row write takes 1.5mSec, while each page erase takes up to 40mSec. You have to erase 4096 pages, and write 32768 rows to fill the chip. Over 4minutes, even without transferring any serial data....

The reason programmers are so much quicker, is they can use the bulk erase, which clears the whole chip. Bootloaders can't do this....
PIC24H



Joined: 02 Mar 2015
Posts: 19

View user's profile Send private message

PostPosted: Thu Jul 16, 2015 2:05 pm     Reply with quote

Thanks for your reply Ttelmah.

Ok I'll try to do that. I am trying to reach the speed of the mplab ide. Mplab takes just several seconds to write it to the pic.
Ttelmah



Joined: 11 Mar 2010
Posts: 19338

View user's profile Send private message

PostPosted: Fri Jul 17, 2015 12:34 am     Reply with quote

The IDE normally programs the chip. Doesn't use the bootloader, so you won't get close to the speed it can manage.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group