Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timonel on TinyX4 #16

Open
BrunoB81HK opened this issue Sep 19, 2020 · 8 comments
Open

Timonel on TinyX4 #16

BrunoB81HK opened this issue Sep 19, 2020 · 8 comments
Assignees
Labels
enhancement New feature or request solved Solved issue

Comments

@BrunoB81HK
Copy link

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

@casanovg casanovg self-assigned this Sep 19, 2020
@casanovg casanovg added the enhancement New feature or request label Sep 19, 2020
@casanovg
Copy link
Owner

casanovg commented Sep 19, 2020

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
Copy link
Author

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
Copy link
Owner

casanovg commented Sep 20, 2020

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
Copy link
Author

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
Copy link
Owner

casanovg commented Sep 21, 2020

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
Copy link
Owner

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:

  • I2C Master: ESP-01 running timonel-mss-esp8266.
  • User application: blink-sl-usitwisl. This is the payload prepared with timonel-hexparser and compiled together with the I2C master to be loaded on the slave later.
  • I2C slave: ATtiny84A-U running timonel-tinyx4-ioel, chosen config on platformio.ini: tml-t84-std-dump. Fuse settings: Low=0x62, High=0xD5, Extended=0xFE.

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
Copy link
Author

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
Copy link
Owner

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

  • Since the changes to adapt the bootloader to the TinyX4 series were minimal, I will publish a new revision on the master branch (v1.6) compatible with both families, TinyX5 and TinyX4. So from that version on, you won't need a specific version for your project.
  • The "-io" (Platformio) and "-ioel" (Platformio, external library) are easy-to-build, upload, and test versions, but they are not optimal in terms of memory usage. If you need to get one or two extra memory pages for your application, it is best to use the "make" versions, compiled with avr-gcc 8.3.0.
  • As soon as I finish adapting Timonel to work on devices with on-chip I2C hardware (e.g. ATmega series), I will start writing the I2C master-side libraries for Raspberry Pi. In the meantime, if you have anything to share about it before, it would be very welcome.

Regards, and have a nice weekend!
Gustavo

@casanovg casanovg added the solved Solved issue label May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request solved Solved issue
Projects
None yet
Development

No branches or pull requests

2 participants