I've just started to think about how to update a (slave) PIC mcu's firmware using another PIC (master) thru I2C. Basically, the master mcu will get the data from its usb port and send it to the slave mcu using i2c....
Does anyone know where could I find any information on this subject ? Thanx a lot... Regards. Victor
The master PIC could for example be a PIC18F4550 and the slave(s) PIC18Fxx 's. So, recent PIC families and none of the older ones ! In any case, the slaves programming (firmware) will have to be done through I2C so they previously have to be programmed with some kind of bootloader that will fill the program memory with data coming from the I2C port.
But why? Any reason you're insisting on i2c? Because:
If you're using a bootloader anyway then you don't ever need the master PIC, program the slave PIC to accept data directly from whatever is convenient: USB, Serial etc. Therefore you don't need i2c.
On the other hand, if you insist on using a master PIC then why waste program memory by requiring a bootloader on the slave PIC? Just use a slave PIC with LVP and use Microchip's documented and published ICSP protocol to program the slave. Therefore again you don't need i2c.
To program the PIC using i2c you prior need a bootloader on the chip... anyway. Same difference. Also the amount of code required to implement an i2c bootloader on the slave is roughly the same as to implement a serial bootloader.
They don't need an ICD, just an ICSP.
Your "master chip" is in effect a built-in ICSP that you're shipping with your product. My suggestion is that rather than have a bootloader in the slave communicating in i2c with the master, have the master directly talk to the slave in ICSP protocol. That way you don't need any bootloader on the slave and you only need to waste 2 i/o pins (RB6&RB7) which you'll be wasting anyway if you program in i2c.
The ICSP protocol is daunting but not that hard. These days there are lots of PICs that don't require high voltage to program provided you're willing to sacrifice another i/o pin for the LVP function.