casanovg / timonel

ATtiny85/45/25 I2C bootloader
MIT License
110 stars 18 forks source link

Timonel on TinyX4 #16

Open BrunoB81HK opened 4 years ago

BrunoB81HK commented 4 years ago

Can this bootloader be fitted to work with the ATTinyX4 family?

casanovg commented 4 years ago

Can this bootloader be fitted to work with the ATTinyX4 family?

Hi Bruno,

A quick look at the Tiny44 datasheet shows that it is quite similar to the Tiny85, it actually has a USI device, but has half the flash memory and RAM.

So in principle, I don't see any reason that prevents Timonel from working on the TinyX4 family as well, with some minor tweaks. So, let's try it ...

I just created a new PlatformIO project folder inside the "testbed" branch to start testing. Also, please upload this firmware onto an ESP8266 module to use it as I2C master.

Regards

BrunoB81HK commented 4 years ago

I uploaded Timonel on an ATtiny84 and uploaded the firmware on the ESP8266. I used the hex parser to conver my .ino script into a payload.h. I'm not quite sure how to proceed for the test.

casanovg commented 4 years ago

The first thing to do would be to check that the I2C master can discover the Timonel device at I2C address 29 (you can change it on platformio.ini) and that it responds to commands through a serial terminal (I use MobaXTerm or PuTTY on Windows).

For this, you must connect SDA, SCL, and ground on both chips and open the serial terminal connected to the I2C master at 115200 bps N, 8, 1. By the way, which master I2C module are you using? If it's an 8266 NodeMCU, the connections go to D3 and D4 as shown in this picture. On the Tiny44 SDA should be PA6 and SCL PA4, according to the datasheet.

The I2C master is already compiled with a small "blink" application (for Tiny85), but it will be useful to test the connection and commands before attempting to compile the master with your own firmware for the Tiny44 (payload). If you have success with the connection, you can place your application on the /data/payloads folder of the master firmware, then rebuild and reflash the ESP8266).

If Timonel is not discovered by the master, It would be useful to set up and enable the Timonel LED_UI option, which flashes a LED to indicate that the bootloader is running and is not initialized by the master. This option can be set on the "configs/tml-t44-std-dump.ini" configuration file (you need to reflash Timonel after this, of course). If you need help with this, please let me know.

BrunoB81HK commented 4 years ago

I'm currently using an ESP-01 and I'm not sure what are the SDA and SCL pins. I am using an ATtiny84 since my Tiny44 are mounted on a PCB and I dont want to damage them. I modified a bit of your code so that it works with a Tiny84 (pretty much only changing every reference of an Tiny44 to one of a Tiny84), but it would probably be better if you can do so yourself.

After uploading my code ont the Tiny84 and the one for the ESP-01, I tried to connect to Timonel with Putty, without luck. I only got a loading animation (/--/...). I verified if I could contact the Tiny84 with i2cdetect -y 1 on a raspberry pi and I was detecting it. I'm not quite sure how to do - Run the "timonel-twim-ss" commands shown on screen for erasing and flashing new firmware on the Tiny85. from here.

What should I do now?

P.S. I don't have a lot of free time right now so my response will probably not be fast.

casanovg commented 4 years ago

Hi!

I haven't used an ESP-01 as I2C master in a long time, since Timonel version 1.0 I think. I normally use a NodeMCU or ESP32, but I just flashed one with "Timonel-MSS-ESP8266" to check that everything works fine.

I made this video with subtitles (sorry for the low quality) so you can see what should happen when connecting both chips and what commands can be used on the serial terminal. The slave is a T85 because I don't have a T84 yet, hope I can get it during the week. The connection diagram for the ESP-01 is this one, there you can see which pins are used as SDA and SCL. I also took some photos of this configuration: Pic-1, Pic-2, Pic-3, Pïc-4.

I also modified Timonel for a T84 instead of a T44, but as I mentioned, I don't have a chip to test it yet. As soon as I have it I'll give it a try and let you know how it goes. If you have any progress before, please let me know.

casanovg commented 4 years ago

Hi,

Yesterday I received the ordered parts, so I was able to test the bootloader on a Tiny84. Fortunately, it works very well!

This is the configuration I used:

Well, now that Timonel is "officially" supported on the TinyX4 family, that would be all from my side. If you need anything else, please let me know. Maybe I will update the demo video over the weekend to show how it works on the Tiny84.

Regards!

BrunoB81HK commented 4 years ago

That is awesome. I had a little bit of time to test it and it seemed to work for me too! Thanks a lot for your help and have a nice day!

Bruno

casanovg commented 4 years ago

Glad it worked for you too! As a wrap-up for this issue, some comments:

Regards, and have a nice weekend! Gustavo