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

There's a way to expand PIC18F program memory?

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



Joined: 13 Apr 2011
Posts: 409

View user's profile Send private message

There's a way to expand PIC18F program memory?
PostPosted: Tue Aug 31, 2021 12:17 am     Reply with quote

I know that some PIC18 has the ability to access external memory and run code from it.
So now I come with these questions.
Can CCS build a bigger program than the PIC flash memory size?
If so, how I can upload the code?
I mean the PIC ISCP doesn't write any external memory, so, how I upload the external memory?

All this is because I'm currently using a PIC18F67J50 and I only have about 9K of instructions left to get to the PIC program memory limits and we are at about 70% of the code that we need to implement.
_________________
Electric Blue
Ttelmah



Joined: 11 Mar 2010
Posts: 19216

View user's profile Send private message

PostPosted: Tue Aug 31, 2021 12:41 am     Reply with quote

On programming, you have to do this with whatever programmer your
external chip needs. The external chip needs to be one that supports
parallel access. So a ROM with a genuine address/data bus, not something
like I2C or SPI. Remember you are going to lose a huge number of pins
on the PIC to do this. Up to 28pins are needed for the bus. You also
need external latches to hold the address bits.
On the code, you have to set the EMCU16 or EMCU20, that enables the
external bus. If these are enabled, the compiler 'knows' about the extra
memory and allows you to write code that uses this.
MicroChip do some parallel access ROM's for exactly this, and companies
like Cypress do some NOR flash memories also in this configuration.
Seriously the loss of pins, makes this less convenient than simply using
a larger PIC. There is going to need to be a major board redesign to add
the hardware for this, so just using a larger PIC is a lot easier....
E_Blue



Joined: 13 Apr 2011
Posts: 409

View user's profile Send private message

PostPosted: Tue Aug 31, 2021 1:14 am     Reply with quote

Thanks for your answer.
I'm not fully understanding if the external memory will be write via ICSP or should I write separately, which will be a mess since I will need to cut the HEX in a exact address.

There's no bigger PIC18F.
Also, a lot of PIC24, specially the bigger ones are out of stock until 6 months or more.

I know because we are trying to put in production another project that uses a PIC24FJ and can't get any of them.
_________________
Electric Blue
Ttelmah



Joined: 11 Mar 2010
Posts: 19216

View user's profile Send private message

PostPosted: Tue Aug 31, 2021 3:17 am     Reply with quote

You need a programmer for the chip you select.
The addresses needed are fixed for you, by the address shifting in the chip.
temtronic



Joined: 01 Jul 2010
Posts: 9099
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Aug 31, 2021 4:26 am     Reply with quote

Have to ask, how much more memory is needed ?
Any chance you can use SPI/I2C memory chip to contain fixed 'data tables' or "LCD messages' ?
Have you looked for any other options to reduce the current size of code ?
Just trying to think what else you could do...

Jay
E_Blue



Joined: 13 Apr 2011
Posts: 409

View user's profile Send private message

PostPosted: Tue Aug 31, 2021 8:17 am     Reply with quote

@Ttelmah With "chip" you mean the PIC or the memory?

@temtronic I don't know exactly but probably around 30K more, my boss gets "creative" and every weekend he elaborate a new "feature".
I'm already make like 4K words of space by optimizing the code like two months ago or more.
The problem with an external memory with strings is that somebody must write those EEPROMs and that's mean it will need more production work.
_________________
Electric Blue
Ttelmah



Joined: 11 Mar 2010
Posts: 19216

View user's profile Send private message

PostPosted: Tue Aug 31, 2021 8:22 am     Reply with quote

Yes, very much agree. If you can remove consts and tables etc., you
can save a lot of program memory.

I have to emphasize just how much work is involved in trying to do
the expanded program memory. You would need several weeks/months of
development time for this. Even if the PIC24's have few months lead
time, you should be able to get samples (I've found samples are available
immediately in general), so you would probably find this really the
much easier way. I'm also very surprised that you can afford to lose
the number of pins involved.
E_Blue



Joined: 13 Apr 2011
Posts: 409

View user's profile Send private message

PostPosted: Tue Aug 31, 2021 8:58 am     Reply with quote

I'm using a 64 pins version, there's a 80, I was thinking in to use that version.
I know is a pain but I have no much options.
Seems like Microchip see no point in to make a bigger memory PIC18.
_________________
Electric Blue
Ttelmah



Joined: 11 Mar 2010
Posts: 19216

View user's profile Send private message

PostPosted: Tue Aug 31, 2021 10:15 am     Reply with quote

Once you go beyond 64K, there is a lot of overhead introduced by page
switching. This probably explains why your code uses so much memory.
So much easier to just have a huge linear address space....
E_Blue



Joined: 13 Apr 2011
Posts: 409

View user's profile Send private message

PostPosted: Tue Aug 31, 2021 12:10 pm     Reply with quote

It has around 23K lines of C code.
It handles a GPRS/SMS modem, two connection protocols, two Simcards, USB, more than 100 remote and local USB commands, verbal SMS mode, six IP/Tel, via UDP or TCP, one remote keyboard databus with many functions, battery charging and protection, remote controls and remote sensors via an RF link and there's a lot to add yet.

Also I have a Bootloader over the air (FOTA) that adds more to the program memory; around 8Kwords until now.
_________________
Electric Blue
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