• How to setup Arduino IDE full support (including binary upload) for my board.

    kodera2t12/07/2018 at 04:33 2 comments

    Here is the way.

    First of all, please add megaavr support (4809 support) in your arduino IDE by installing "Arduino UNO WiFi Rev2" in board manager. Also please confirm normally compiling "blink" or "bareminimum" without any issue in Arduino IDE. If they are ok, now the time to add support!

    1. Download avrdude.conf including 4809 setting.

    The author of UART-UPDI programmer, Elatingas releases avrdude.conf including various UPDI supported MCU setting. Just download "avrdude.conf" and save it to

    The above position is the case of OSX. Version may be different for your case. (of course, "kodera2t" is the username and please replace it with your account name). This file swapping is not harmful (not affect on another board support).

    2. Find megaavr setting folder in your system.

    If UNO WiFi Rev2 is correctly installed, the files above should be installed in the directly indicated in the top of above image (also "kodera2t" is the username).

    3. Edit "platform.txt"

    Open "platform.txt" and find the -Pusb in "tools.avrdude.upload.pattern" and replace it with {serial.port} as above. and save it.

    4. Edit "boards.txt"

    Please find "uno2018.upload.protocol=xplanedmini_updi" and replace it with "jtag2updi" (Here I've changed the board name but it does not matter, as you wish.)

                                                                  That's all!!!

    You will see the board name in the Tools menu and select proper port and click upload in Arduino IDE... then

    avrdude: Version 6.3-20171130
             Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
             Copyright (c) 2007-2014 Joerg Wunsch
             System wide configuration file is "/Users/kodera2t/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino14/etc/avrdude.conf"
             User configuration file is "/Users/kodera2t/.avrduderc"
             User configuration file does not exist or is not a regular file, skipping
             Using Port                    : /dev/cu.SLAB_USBtoUART
             Using Programmer              : jtag2updi
             Overriding Baud Rate          : 115200
    JTAG ICE mkII sign-on message:
    Communications protocol version: 1
      boot-loader FW version:        1
      firmware version:              6.00
      hardware version:              1
      boot-loader FW version:        1
      firmware version:              6.00
      hardware version:              1
    Serial number:                   00:00:00:00:00:00
    Device ID:                       JTAGICE mkII
             AVR Part                      : ATmega4809
             Chip Erase delay              : 0 us
             PAGEL                         : P00
             BS2                           : P00
             RESET disposition             : dedicated
             RETRY pulse                   : SCK
             serial program mode           : yes
             parallel program mode         : yes
             Timeout                       : 0
             StabDelay                     : 0
             CmdexeDelay                   : 0
             SyncLoops                     : 0
             ByteDelay                     : 0
             PollIndex                     : 0
             PollValue                     : 0x00
             Memory Detail                 :
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
               prodsig        0     0     0    0 no         61   61      0     0     0 0x00 0x00
               fuses          0     0     0    0 no          9    0      0     0     0 0x00 0x00
               fuse0          0     0     0    0 no          1    0      0     0     0 0x00 0x00
               fuse1          0     0     0    0 no          1    0      0     0     0 0x00 0x00
               fuse2          0     0     0    0 no          1    0      0     0     0 0x00 0x00
               fuse4          0     0     0    0 no          1    0      0     0     0 0x00 0x00
               fuse5          0     0     0    0 no          1    0      0     0     0 0x00 0x00
               fuse6          0     0     0    0 no          1    0      0     0     0 0x00 0x00
               fuse7          0     0     0    0 no          1    0      0     0     0 0x00 0x00
               fuse8          0     0     0    0 no          1    0      0     0     0 0x00 0x00
               lock           0     0     0    0 no          1    0      0     0     0 0x00 0x00
               data           0     0     0    0 no          0    0      0     0     0 0x00 0x00
               usersig        0     0     0    0 no         64   64      0     0     0 0x00 0x00
               flash          0     0     0    0 no      49152  128      0     0     0 0x00 0x00
               eeprom         0     0     0    0 no        256   64      0     0     0 0x00 0x00
             Programmer Type : JTAGMKII_PDI
             Description     : JTAGv2 to UPDI bridge
             M_MCU hardware version: 1
             M_MCU firmware version: 6.00
             S_MCU hardware version: 1
             S_MCU firmware version: 6.00
             Serial number:          00:00:00:00:00:00
             Vtarget         : 5.0 V
    avrdude: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description
    avrdude: AVR device initialized...
    Read more »

  • New board is born..

    kodera2t12/06/2018 at 06:31 0 comments

    As I've presented, I've made several ATmega4809 board but unfortunately pin assignment between my board and newly released Arduino UNO WiFi Rev2 (which is with ATmega4809) are very different (we can just two GPIO accessible from Arduino IDE). So this time I made more Arduino IDE friendly ATmega4809 board, which GPIO are fully accessible from Arduino programming environment.

    Details can be found in the following video...

  • Blinky test on ULTRA 4809 Explorer

    kodera2t05/22/2018 at 06:09 0 comments

    As presented, now the ULTRA 4809 Explorer is available at tindie. By the UART-UPDI function with avrdude, LED blinky test is super-easy! Here I would explain how to.

    Before starting, you will need to install

    • Atmel Studio (latest one)


    • Arduino IDE

    Arduino IDE should be installed in order to get avrdude.

    First of all, please find "avrdude" in Arduino IDE and copy it (not move it, otherwise Arduino IDE will not work anymore) to some working directory. (in this case, I made it on desktop named "4809writer".

    In the working directory, we also need  "avrdude.conf", which is available at ELTangas's jtag2updi repository.

    Now let's start new project at Atmel Studio..!

    And simply select GCC C executable and name it some wonderful name (in this case, simply 4809_blink..)

    , and select proper device, YES ATmega4809 !! (if not appears, your Atmel Studio is older version. Please update to the latest one.)

    And Let's write short program for PB5 LED blink. The notation is the same as Xmega.

    And select "Rebuild Solution"

    If compile and link are succeeded, .hex file will be produced in the project/Debug directory. Just copy the hex file to your working directory (containing avrdude).

    As you see, please put your hex file init (where dac.hex and oled.hex are different project ones, please ignore it.)

    Now please connect USB cable between your ULTRA 4809 Explorer board and computer, then check system recognition at device manager. This special board has 2ch UART and smaller number port (in this case, COM4) is connected to UPDI converter.

    Now the time to binary uploading. Just command it, the LED connected to PB5 will blink as you wish

    This super-easy special Atmega4809 all-in-one developing board is available at my tindie store. Don't miss it!!

  • More details about the current board form..

    kodera2t05/13/2018 at 11:59 0 comments

    Here is a bit more details about the latest board...

  • Demonstration of binary uploading through avrdude to Atmega4809

    kodera2t05/13/2018 at 03:21 0 comments

    Here you can see the demonstration movie of binary uploading of my board!

    The .hex file uploading command is

    avrdude -c jtag2updi -P COM# -p m4809 -U flash:w:name.hex

    , where COM# is the port number of your system and name.hex is the name of the binary. It's very handy now! 

  • Eventually, programmer is embedded, no need Atmel ICE anymore!

    kodera2t05/12/2018 at 13:03 0 comments

    Eventually, my board becomes a "independent board".

    It consists of

    • FTDI FT2232D Dual USB-UART interface.
    • Atmega88PA, working as jtag-UPDI interface
    • Atmega4809 , the main MCU
    • OLED display connected through SPI to Atmega4809

    Not always FT2232D-Atmega88PA connection is not necessary, and its connection can be selected ATmega88PA or UART1 of Atmega4809. The other UART of FT2232D is always connected to UART0 of Atmega4809.

    By the proper jumper setting, one of UART of FT2232D is connected to Atmega88PA and direct binary upload is enabled by avrdude as follows:

    This implementation of jtagupdi is made by ElTangas, the same author as STK500 UPDI interface implementation. By the sake of this great implementation, now it's very close to be "Arduino-like" board. Currently binary is made by Atmel ICE and .hex file is uploaded by avrdude. The modified avrdude.conf is also included in the ElTangas's GitHub. 

  • Arduino UNO as UPDI programmer for ATmega4809

    kodera2t05/06/2018 at 02:32 1 comment

    So I've found, no need of expensive ATmel ICE for programming ATMega4809 UPDI program anymore!!

    Eltangus already implemented UPDI programmer firmware also compatible with Arduino at GitHub, which indeed makes ATMega328P working as a UPDI speaking STK500!! The procedure to make it is quite easy.

    (Step 1) Write UPDI firmware on your Arduino UNO and wiring with ATMega4809 UPDI

    The pre-compiled binary is available at Eltangus's github. You may need Atmel-ICE (or directly from Arduino IDE) and after writing it, your UNO will turns into UPDI programmer. Please don't forget "disable auto RESET" by disabling capacitor connecting from DTR of USB-UART to RST of Mega328P.

    As is written in Eltangus's page, wiring is very simple. Just connecting PD6 (D6 of Arduino pin) and UPDI of ATMega4809 with VCC and GND is enough to complete.

    (Step 2) Setting up on ATmel Studio

    Original state of Atmel Studio will not recognize the existence of "UPDI-STK500 by UNO". Just click "Add target" and

    Select tool as "STK500" and select appropriate serial port on your system. Now almost done!

    Now the time for programming ATmega4809 through UPDI. STK500 does not know ATmega4809 and just select "ATmega644P" and check off "Erase device before programming" and click "Program".... (Don't need to think too serious, for example interface selection. Just default ISP is enough to complete). As for the implementation, some function is not implemented yet but at least we can write binary through UPDI.

    You will see the binary is uploaded to ATmega4809 !!!

  • Short note about "fatal error" on RTOS related project at Atmel Studio

    kodera2t05/05/2018 at 12:04 0 comments

    Sometimes I encountered this type of "fatal error", especially with RTOS project (even if we don't touch this part of code). 

    Don't worry, just restarting Atmel Studio and try again, this error will be solved (some bug or I don't know but.).

  • How to start Configurable Custom Logic on ATmega4809

    kodera2t04/19/2018 at 07:24 0 comments

    Nowadays, Atmel is a part of Microchip and some technology is transferred into ATmega chips. (I am not sure which Microchip or Atmel is the original one but..) Configurable Custom Logic (CCL) is one of novelty technique for AVR (PIC's has the name "Configurable Logic Cell", why don't they put same name for same "Microchip"??)

    CCL is a kind of tiny programmable logic with look-up-table, same as FPGA or CPLD. Here I would like to show you how to use it through Atmel Studio.

    One notice before jumping into the body explanation is,

    You don't need to write any code!

    Let' get started!!

    Let start on AtmelStudio selecting "Atmel Start Project"

    And click "CREAT NEW PROJECT"

    In the window, just put "4809" for search term and select "ATmega4809-AFR" and click "CREATE NEW PROJECT"

    Now the project is fully empty and let click "Add software component"

    Just input "CCL" for search term and click "Add component(s)"

    Now your project will grow up with "Digital_Glue_logic_0".

    Let' just click "CCL" on the left side of the window.

    Now the time to connect it. I/O pins of CCL are limited PA0, 1, 2, and PC0, 1, 2. Now the board has accessible pins of PC0, 1, 2 and let make it as input and output as PC3. (You can define as you wish, within the limitation..) Don't forget to activate "LUT1" by check box on.

    And click and select LUT1 box and make it as simple AND.

    Now let's configure pin status by "PINMUX". Already PC0, 1, 2 are set as input and PC3 as output.

    Let activate internal pull-up for input and set the initial state of output (PC3) as low.

    It's done! And let's click "GENERATE PROJECT"

    Window will appear and let's name it as you wish.

    And now all the required source should be set up. Let's check "main.c"


    It's holy empty!

    MCU does nothing for the job. Just initialize MCU, and over.

    Now, let "rebuild solution"

    Since it is empty, so you sit see "Data Memory Usage" 0bytes!!

    Exactly the same as the general program. Binary can be uploaded through UPDI.

    Now it's done! Switching input level will show the logic level as defined!! ATmega4809 is now working as "single AND"!

  • How to start project on your 4809 Explorer board

    kodera2t04/16/2018 at 04:52 0 comments

    I made several experimental board (may be delivered on my tindie store) and here I would like to explain how to start project with this board on Atmel Studio with Atmel ICE.

    First of all, we need to install Atmel Studio (if not yet) and connect it to the onboard UPDI connector. The board is USB bus power so we need additional USB cable connection from your PC to the board.

    UPDI connector has a right direction so please follow the onboard guideline.

    Now let's start Atmel Studio and select "Atmel Start Example Project"

    and click "Browse Examples"

    Just entering "4809" as the search word, you will find 4 examples. (still not so much, indeed.)

    Now let's select the first "ADC Basics with megaAVR 0-Series" and click "Open Selected Example"

    You will see this example uses three blocks, VREF_0, ADC_0, and USART_0. Now let's click "ADC_0" and see which pin is used for.

    In the bottom of window, you will see the current setup for the example program. The PD6 is selected as ADC input. PD6 is "AN" of mikroBUS pinout, and it's ok for the check.

    And let's switch to USART_0 setting.

    The USB-USART interface (CP2102) of "4809 Explorer board" has a connection with PA0 and PA1 so let's switch to..

    RXD to PA1 and TXD to PA0.

    Now the online preparation is finished. Let's click "Generate Project"!!

    You will see the Atmel start importer windows and please name your new project name as you wish, and after clock "OK" you will see the 

    Downloaded files in the solution explorer. The files in src directory are prepared for the definition of above (like USART settings..)

    Now the source files are prepared (no need of modification) so let's select "Rebuild Solution"

    Currently the files are "as is" so it will not produce any error.

    Now let's start binary uploading to the 4809 explorer...

    You will see the device programming window, and let's select Tool as "Atmel-ICE" and device "ATmega4809" and select UPDI as interface and click "Apply"

    After setting UPDI clock as default 100kHz by click "Set" in the bottom-right button, let's read device signature. If it presents "0x1E9651", then the connection is succeeded.

    Now the time for uploading. Select "Memories" and just click "Program" will flash your board with the new binary!

    This sample program will read ADC and will output to USART, so just read USART with serial console, you will see the value of PD6(AN) pin voltage of onboard connector.

    In the very the same manner, the sample with OLED display can be made by "ATmega4809 RTOS Example". Let's try!