View previous topic :: View next topic |
Author |
Message |
E_Blue
Joined: 13 Apr 2011 Posts: 417
|
There's a way to expand PIC18F program memory? |
Posted: Tue Aug 31, 2021 12:17 am |
|
|
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: 19537
|
|
Posted: Tue Aug 31, 2021 12:41 am |
|
|
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: 417
|
|
Posted: Tue Aug 31, 2021 1:14 am |
|
|
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: 19537
|
|
Posted: Tue Aug 31, 2021 3:17 am |
|
|
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: 9241 Location: Greensville,Ontario
|
|
Posted: Tue Aug 31, 2021 4:26 am |
|
|
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: 417
|
|
Posted: Tue Aug 31, 2021 8:17 am |
|
|
@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: 19537
|
|
Posted: Tue Aug 31, 2021 8:22 am |
|
|
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: 417
|
|
Posted: Tue Aug 31, 2021 8:58 am |
|
|
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: 19537
|
|
Posted: Tue Aug 31, 2021 10:15 am |
|
|
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: 417
|
|
Posted: Tue Aug 31, 2021 12:10 pm |
|
|
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 |
|
|
|