Using "slot 4" on a 20X2, a couple questions

Hemi345

Senior Member
I saw Buzby's thread on getting slot 4 working with his 20X2 and am looking into this for my Humidistat V2 project. I was reading through the documentation on the "run" command and it mentions the following:
Running a program from external i2c has some restrictions
1) The i2c bus is reserved exclusively for the program reading.
2) The i2c pins cannot be used for any other purpose.
3) Any hardware i2c/spi commands are completely ignored.
1) If the program is running from internal/default slot 0 of my 20X2, the i2c commands should work to access the other i2c devices on the bus (OLED, RTC, etc), correct?
2) Is the Microchip 24LC512 compatible with this feature? It's arranged as 64K x 8 (512 Kbit) where as the 24LC128 is arranged as 16K x 8 (128 Kbit).
2a) If the 24LC512 is compatible, is the remaining ~384K available to use for storage when running from internal/slot 0?

Thanks.
 

Buzby

Senior Member
Hi Hemi,

My project does not use 'Run', it uses 'Booti2c'.

'Run' uses the i2c bus all the time it is running Slot 4, fetching instructions to execute. You can switch between code running in Slot 0 and Slot 4 as needed.

'Booti2c' uses the bus to replace whatever code is in Slot 0 with the new code from Slot 4. You can't switch back and forth between the slots, but the bus is free after Booti2c has finished it's work.

I use Microchip 24LC256 with no problems, and I think I did use the 24LC512 a while back.

The extra space in the eeprom can be used with Booti2c, in fact, the whole 256 or 512 is available after Booti2c has finished.

I've never tried accessing the extra space while using Run, but my suspicion is it will not work, too much i2c stuff going on 'under the hood'.

Using external eeprom is easy for basic memory extension, but there is a bit more to learn if you want to use the memory for code as well.

Cheers,

Buzby
 

hippy

Technical Support
Staff member
I think the answers to your questions are "probably". I can't see that it wouldn't work or couldn't be coerced to work but l may be forgetting something. The easiest way might be to try it.

Or alternatively use a 28X2 which has four internal program slots and potential problems of trying to use both should not arise.
 

Hemi345

Senior Member
Thanks Buzby for info on booti2c. I thought you were trying to expand the program space, which is what I'm wanting to do.

I'm commited to using the 20X2 as the PCB is already made. The 20X2's prog space was was totally sufficient till I thought of some additional functionality to include with this project. I'm still refactoring my code so I might be able to make it fit but I already have a lot of menu stuff (for OLED display) stored in the ext EEPROM.

I just found a spare 20X2 DIP. I'm going to pop it into my AXE091 and give it a whirl.
 

Hemi345

Senior Member
Works great. I am able to read and write data on the external eeprom (starting at address 1024) and interact with other i2c devices while in slot 0. Then switch to slot 4 and do non-i2c stuff and switch back.

So if the maximum program size is 4096 bytes, I should probably store general data in the external eeprom starting at address 4097, right?
 
Top