0

This is similar to Is it possible to program an AVR chip (atmega328p) via i2c?, but not exactly, and that thread is a little shy on details.

I have an ATTiny88 attached via I2C to a Raspberry Pi, with the Pi as master. The system is remote from me, but I can contact the Raspberry Pi via a WiFi connection at the remote location. Updating the software on the Pi is quite easy, of course, but it would be really great if I could upload a compiled file from the IDE to the Pi and then download to the ATTiny88 over I2C. This would make firmware changes and updates to the Arduino easy.

7
  • 2
    what results did you get in your research? Commented Sep 7, 2024 at 1:35
  • Even if it is theoretically possible, you will not find any guidelines. You're supposed to program ATTiny88 using hardware like USBASP. Commented Sep 7, 2024 at 12:17
  • 1
    Does it matter that's I2C? Commented Sep 7, 2024 at 14:21
  • 1
    there's an I2C bootloader project on GitHub Commented Sep 7, 2024 at 15:29
  • The only result I got is that it should be possible, but without details I am rather at an impasse. Do you have a link to the I2C bootloader project on GitHub? It sounds like a good place to start, Commented Sep 7, 2024 at 17:57

2 Answers 2

2

According to the datasheet:

The device provides a self-programming mechanism for downloading and uploading program code by the MCU itself. The self-programming can use any available data interface and associated protocol to read code and write (program) that code into the program memory. The SPM instruction is disabled by default but it can be enabled by programming the SELFPRGEN fuse (to “0”).

So it would seem that it is possible. To be practical you would need to fit the code to do the self-programming, plus the code to actually do something useful, into the 8K of flash memory.

You would also need to organise the code in some way so that when reprogramming, you don't erase and overwrite the code doing the reprogramming during the process.

This could be a bit tricky to implement, but not impossible.

1

Assuming you are currently using the tiny with some i2c library, that library most likely won't allow it. If you want to simplify the task at hand, consider the problem from another viewpoint :

  • can you reset the tiny using the I2C interface ? (tip : create a "Reset" register)
  • Can you use the same pins for programming the tiny (but not using I2C, rather Serial or SPI).

If you can get the above two sub-projects done, you'll be able to do what you want. Simply set the pins to Serial (or SPI) at startup for a few seconds, then switch to I2C.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.