pyupdi + atmega4808

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

I tried pyupdi with two atmega4808 micros and two different USB2serial converters, but I couldn't have made the thing work.

I wired it up as https://github.com/mraardvark/py... described it.

I tried it on linux, python 2.7.6. This is what I got (tried 19200 and 57600 baud too):

tom@tom-HP:~/_UPDI/pyupdi-master$ python pyupdi.py -d mega4808 -c /dev/ttyUSB0 -b 115200 -v -f blinky_m4808.hex
INFO:phy Opening /dev/ttyUSB0 at 115200 baud
INFO:phy send : [0x0]
INFO:link STCS to 0x03
INFO:phy send : [0x55, 0xc3, 0x8]
INFO:link STCS to 0x02
INFO:phy send : [0x55, 0xc2, 0x80]
INFO:link LDCS from 0x00
INFO:phy send : [0x55, 0x80]
INFO:phy receive : []
INFO:link UPDI not OK - reinitialisation required
INFO:phy Sending double break
INFO:phy Opening /dev/ttyUSB0 at 115200 baud
INFO:link STCS to 0x03
INFO:phy send : [0x55, 0xc3, 0x8]
INFO:link STCS to 0x02
INFO:phy send : [0x55, 0xc2, 0x80]
INFO:link LDCS from 0x00
INFO:phy send : [0x55, 0x80]
INFO:phy receive : []
INFO:link UPDI not OK - reinitialisation required
Traceback (most recent call last):
  File "pyupdi.py", line 157, in <module>
    _main()
  File "pyupdi.py", line 88, in _main
    device=Device(args.device))
  File "/home/tom/_UPDI/pyupdi-master/updi/nvm.py", line 17, in __init__
    self.application = UpdiApplication(comport, baud, device)
  File "/home/tom/_UPDI/pyupdi-master/updi/application.py", line 17, in __init__
    self.datalink = UpdiDatalink(comport, baud)
  File "/home/tom/_UPDI/pyupdi-master/updi/link.py", line 30, in __init__
    raise Exception("UPDI initialisation failed")
Exception: UPDI initialisation failed
INFO:phy Closing /dev/ttyUSB0

Does anyone have any idea what to do? I can try it and post the response.

Tom

signature

Last Edited: Thu. Feb 7, 2019 - 02:10 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Could it be related to Permissions on ttyUSB0 ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Good point, thanks.

I forgot the board at work, I'll check it on Monday and report the result here.

Tom

signature

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Hello,

permissions were okay. Today I tried it with FTDI232 usb2ttl chip and it works now. I want to thank the author(s) of pyupdi for such an awesome program.

 

Here is blinky_m4808.asm I tested the micro with:

 

// blinky_m4808.asm by tomcan

.include "../_avr_include/m4808def.inc"
.include "../_avr_include/blinky-uni.inc"    // _delay n

//////////////////////////////////////////////////////////////
.MACRO STXI         ;Arguments: Address16bit, Immediate
    ldi XH,high(@0)
    ldi XL,low(@0)
    ldi macrotmp,@1
    st  X,macrotmp
.ENDM

.MACRO STOREI         ;Arguments: Address8bit, Immediate
    ldi macrotmp,@1
    .if    @0>0x3F
        sts    @0, macrotmp
    .else
        out    @0, macrotmp
    .endif
.ENDM
//////////////////////////////////////////////////////////////

.def tmp      = R16
.def macrotmp = R17
.equ LEDDDR   = PORTA_DIRSET
.equ LEDPORT  = PORTA_OUT
.equ LEDPIN   = 2

//////////////////////////////////////////////////////////////
    .org 0
    rjmp start

    .org INT_VECTORS_SIZE
//////////////////////////////////////////////////////////////
start:
    STOREI CPU_SPH,high(RAMEND)
    STOREI CPU_SPL,low(RAMEND)
    STXI LEDDDR,1<<LEDPIN

mainloop:
    STXI LEDPORT,1<<LEDPIN
    _delay 5
    STXI LEDPORT,0
    _delay 15

    rjmp mainloop

/// EOF

 

Tom

 

signature

Last Edited: Mon. Feb 11, 2019 - 10:03 PM