Library not working on Nano Every

Hi everyone!

I am a self-taught hobby programmer and I am working on my first Arduino project: a drum-machine very much like the legendary Roland TR-909 rhythm composer. It is a 16 step sequencer that sends triggers and control voltages to 11 already existing modules that generate the drum sounds. Actually, it goes quite well, I have a working prototype with most features working.

My sketch works fine on a Nano V3. However, I am running low on SRAM because I need a lot of global variables and therefore I want to switch to a Nano Every. My application uses two TLC5940 IC's (16 channel PWM LED drivers) and the library used to manage the IC's will not compile on the Nano Every. It is the Tlc5940 library by Paul Stoffregen. It gives an error saying : "unknown chip". My Google searches did not come up with a solution so far.

On Github there is an issue in the TLC5940 repository from PaulStoffregen that was raised by other users having the same problem with the library on Nano Every and Nano IoT. I also reacted in that issue but the author of the library has not responded so far.

In another issue on the same library and Teensy LC the author says that he is not going to spend time on such an old library for such an old chip. So I have little hope that he is going to fix the library any time soon. I, being a simple hobby programmer, just don't have the skills to fix it myself.

Is there any hope that I will be able to use this library on a Nano Every? My hardware is finished and working, replacing the Nano v3 for a Nano Every would be the most easy solution for me right now.

If needed, I can post schematics and/or my sketch. But they actually work, the library is the problem here.

Thanks in advance,

Willem

the library uses classic AVR timers. the 4908 on Nano Every has very different timer peripherals.

use one of the MCU supported by the library. there are Mega (ATmega2560) and Sanguino (ATmega1284) which have plenty of SRAM and flash

Thanks Juraj for your reply. Hmmm, I was hoping to use a pin compatible drop in replacement :confused:. So this 'timer peripherals-stuff' makes it impossible to adjust the library to work on a Nano Every?

I know that it is very easy to adjust the PWM frequency of the TLC5940 by using different values for the TLC_GSCLK_PERIOD and the TLC_PWM_PERIOD parameters that are defined in the library. Even I was able to do it. Could it help to overcome the timer peripherals issue?

Did you try the Register Emulations in the Arduino IDE Tools menu set to "ATmega328" ?
That emulates (part of, not all) the register names of the AVR family.
I am not sure if that includes the timer register names.
Guy

gbaets:
Did you try the Register Emulations in the Arduino IDE Tools menu set to "ATmega328" ?
That emulates (part of, not all) the register names of the AVR family.
I am not sure if that includes the timer register names.
Guy

I did. It doesn't cover timers

Yep, tried it also, does not work...

Ok, I have made a TLC5940 library that can be used with the Arduino Nano Every (ATmega4809). I came across the e-book "Demystifying the TLC5940" by Matthew T. Pandina, wich describes step by step how to create a library for the TLC5940. I modified the code for the timers, the port registers, the SPI and the ISR, and I added a parameter to adjust the PWM frequency. It was quite an educational experience because 2 months ago, I had never heard of ports, registers and timers!

The library can be found here: GitHub - ScharreSoft/Tlc5940_AVR0: A Tlc5940 library for the Arduino Nano Every (ATmega4809)
I would say that the library could be adapted to work with other microcontrollers that use the same timer peripherals, i.e. the megaAVR® 0-series, the tinyAVR® 0-series and the tinyAVR® 1-series.

2 Likes

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.