Support for megaAVR 0-series like ATmega4808/4809? Topic is solved

ChibiOS public support forum for topics related to the Atmel AVR family of micro-controllers.

Moderators: utzig, tfAteba

wolf
Posts: 25
Joined: Mon Dec 31, 2012 1:55 pm
Location: France
Been thanked: 2 times

Support for megaAVR 0-series like ATmega4808/4809?  Topic is solved

Postby wolf » Mon Feb 07, 2022 4:30 pm

Hi all!

Are there plans for supporting megaAVR 0-series devices like ATmega4808/4809?
I'm aware that these are not the most modern devices, and not really revommended for new designs.
I'm well familiar with the STM32 product range too, as we use these at work as the main controller line.
So my question is entirely focused on AVR support, and not what controller to use for what purpose.

The reason I ask: The ATmega4809 is used on the ARDUINO NANO-Every boards.
With 48kB Flash, 6 kB Ram, more timers, serial links and more, it has some advantage over the 328p on the "normal" Nano boards.

Given the fact, that including a well optimized fatfs to read data from an SD Card leaves very little ressources for your application on standard UNO/NANO with the 328p, I'm thinking of using a NANO Every board for a project.

5V operation of the ATmega4809 has some advantages/disadvantages too, not needing level shifters on some extertnal devices, but on others.

Many thanks for your thoughts,
Wolf

https://store.arduino.cc/collections/na ... th-headers

wolf
Posts: 25
Joined: Mon Dec 31, 2012 1:55 pm
Location: France
Been thanked: 2 times

Re: Support for megaAVR 0-series like ATmega4808/4809?

Postby wolf » Wed Mar 02, 2022 10:34 am

Hi all,

well, it seems there is not a lot of interest in this topic.
Still the NANO-EVERY has some advantages over the standart NANO board, not only in terms of RAM and FLASH amount and beeing in one linear address space (doing away with the PROGMEM stuff).

I started of a hal port for the ATMega-0-series in my spare time myself.
* Using the RTC for tick generation
* Tick mode OK
* Tickless TODO
* I2C OK
* SPI (polled and IRQ) Ok
* PAL (optimized forATMega4809) OK
* SERIAL (4 USARTS) OK
* TIM system (GPT, ICU, PWM) TODO

There were some hurdles to overcome though:
For downloading I use AVRDude via a batch file OK

After some cleanup, I will upload an experimental port for testing/commenting/correcting, - if anybody is interested?

Best reagrds Wolf

User avatar
tfAteba
Posts: 547
Joined: Fri Oct 16, 2015 11:03 pm
Location: Strasbourg, France
Has thanked: 91 times
Been thanked: 48 times

Re: Support for megaAVR 0-series like ATmega4808/4809?

Postby tfAteba » Wed Mar 02, 2022 11:31 am

Hello Wolf,

Nice work,

I'm interrested on what you do, you already made a lot of work.

Can you share the Source code that we can have a look?

I also recommend you to run the test-suite in order to make a bench mark on chiniOS RT/NIL/and OSLIB
regards,

Theo.

wolf
Posts: 25
Joined: Mon Dec 31, 2012 1:55 pm
Location: France
Been thanked: 2 times

Re: Support for megaAVR 0-series like ATmega4808/4809?

Postby wolf » Wed Mar 02, 2022 3:22 pm

Hello Theo,

i'm still cleaning up. I don't have an AVR debugger at hand, all is done with debug outputs and a digital scope, thats rather tedious, but i will get there.
Once presentable, i'll send you an experimental version. This will surely take a few more days.

Best regards to the community,

Wolf

p.s. I'll make a guide concerning downloading the *.hex file and setting up fuses.
As mentioned before, this is not straight forward, but AVRdude with an appropriate batch file makes it a seamless procedure 100% reliable.

wolf
Posts: 25
Joined: Mon Dec 31, 2012 1:55 pm
Location: France
Been thanked: 2 times

Re: Support for megaAVR 0-series like ATmega4808/4809?

Postby wolf » Thu Mar 03, 2022 7:31 pm

Hi all,

I got the tickless mode running, periodic was already OK.
I ran the test suites too, there is one error in the semaphore test, i still have to investigate (see files attached).

Best regards Wolf
Attachments
ATMega4809_tests.7z
(2.38 KiB) Downloaded 160 times

wolf
Posts: 25
Joined: Mon Dec 31, 2012 1:55 pm
Location: France
Been thanked: 2 times

Re: Support for megaAVR 0-series like ATmega4808/4809?

Postby wolf » Fri Mar 04, 2022 11:35 am

Hi all,

the error in my previous mail was due to a timeout value set too small (semaphore test 2ms -> 5ms) - OK now
All of the factory test runs OK now, after increasing CH_CFG_MEMCORE_SIZE to 512 - OK now

See files attached.

Best regards,

Wolf
Attachments
test_suites_ATMega4809_20MHz.7z
(2.41 KiB) Downloaded 158 times

User avatar
tfAteba
Posts: 547
Joined: Fri Oct 16, 2015 11:03 pm
Location: Strasbourg, France
Has thanked: 91 times
Been thanked: 48 times

Re: Support for megaAVR 0-series like ATmega4808/4809?

Postby tfAteba » Sun Nov 20, 2022 11:35 pm

Hi Wolf,

Nice work, you have almost finish the port and the implementation of several drivers.

If you want you can share your work, it can be interesting for the community 8-) .
regards,

Theo.


Return to “AVR Support”

Who is online

Users browsing this forum: No registered users and 1 guest