I have both PIC18 and PIC24 microcontrollers with 256KiB of flash memory.

My code size is 400kB and cannot be stored in the flash memory of those MCUs anymore. So I'm thinking about using external flash memory to hold the program code.

Can I store my executable file in the external flash and execute it from there? How do I do that?

  • 3
    \$\begingroup\$ Why don't you choose a PIC with a larger Flash memory instead? Should be simpler. \$\endgroup\$ – m.Alin Jan 6 '14 at 11:42
  • 1
    \$\begingroup\$ Is that 400KiB all code (instructions)? Of a large part of it is constant data you might put only that in external storage (I2C/SPI eeprom, flash card, etc). \$\endgroup\$ – Wouter van Ooijen Jan 6 '14 at 14:22
  • \$\begingroup\$ @Alin:I don't want to increase cost of my project and i already have many controller with 256Kb flash memory. \$\endgroup\$ – shail korat Jan 7 '14 at 4:36

There are PIC24 & dsPIC33 models with 512KB flash.

PIC18F8622 & 8722, and some other PIC18F's (87J50, 97J60, for example) have external bus interface, you can put a parallel flash (29xx-type) there, and the external bus can address up to 2MB.

From the datasheet, we can see that this can be used to store program code:

The External Memory Bus (EMB) allows the device to access external memory devices (such as Flash, EPROM, SRAM, etc.) as program or data memory.

Using other types of interface to connect to an external flash might be problematic as you would not be able to run the code from the flash directly, instead, you'd have to copy the code into RAM before running it - but since these microcontrollers have extremely limited RAM resources, this would severely limit the usefulness of such a solution (you'd have to implement some kind of paging/overlay technique).

Here's Microchip's product selection tool, allowing you to search for models with certain features: http://www.microchip.com/maps/microcontroller.aspx

  • \$\begingroup\$ @Valko: Thanks for your guidance.So we can interface up to 2MB (29xx)size as you previously said.I don't know how this stuff work to do coding.If you have any example than it is better for me. \$\endgroup\$ – shail korat Jan 7 '14 at 4:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.