Skip to content

ATtiny1617: program does not run, flash verify fails #58

@elektrinis

Description

@elektrinis

I'm running MPLAB X IDE and trying to start a simple blinker program.
My ATtiny1617 is on my own board.
I'm using ATtiny416 Xplore nano as an UPDI programmer. It has an onboard debugger, but it is locked to tiny416, so it will not work for tiny1617 directly from the IDE. Locking is an extremely dumb decision, preventing people from onboarding more easily. But carrying on.
I've cut the traces to tiny416 and connected it to my tiny1617. And using pymcuprog in command line.
It flashes successfully, but program does not run, led pin remains an input, as if the mcu is in reset state.

Please note: this same hardware contraption was working when I used atmel studio 8 years ago. I've dug it out now, led was still blinking when powered on. So hardware is fine. I'm trying to run the same code from 8 years ago, so code is fine as well. And it does run in simulation.

My flashing routine:
pymcuprog write -d attiny1617 --erase --verify -f .\program.hex

Output:

Connected to mEDBG CMSIS-DAP from Atmel (serial number ATML2795041800000764)
Debugger firmware version 1.13.43
Debugger hardware revision 0
Device mounted: 'attiny416'
Warning: you are attempting to use a device which is not the one which was mounted on the kit!
Cut all straps between the debugger and the on-board target when accessing an external device!
Pinging device...
Ping response: 1E9420
Erasing device before writing from hex file...
Writing from hex file...
Writing flash...
Verifying flash...
pymcuprog.programmer - ERROR - Verify failed for flash memory:
pymcuprog.programmer - ERROR - Verify mismatch starting at location 0x000000: 0x0C vs 0x00 (is the memory section erased?)
Verification failed!
Writing fuses...
Verifying fuses...
OK
Done.

After this my led stopped blinking, so it clearly did something. But new code is not running.
Note that flash memory starts at 0x008000, but when verifying it says 0x000000.

I've tried erasing and then reading, expecting the memory to be empty. But it's not:

> pymcuprog erase -d attiny1617
Connecting to anything possible
Connected to mEDBG CMSIS-DAP from Atmel (serial number ATML2795041800000764)
Debugger firmware version 1.13.43
Debugger hardware revision 0
Device mounted: 'attiny416'
Warning: you are attempting to use a device which is not the one which was mounted on the kit!
Cut all straps between the debugger and the on-board target when accessing an external device!
Pinging device...
Ping response: 1E9420 (correct, ATtiny1617)
Chip/Bulk erase:
- Memory type eeprom is conditionally erased (depending upon EESAVE fuse setting)
- Memory type flash is always erased
- Memory type lockbits is always erased
Erased.
Done.
> pymcuprog read -d attiny1617 -m flash
Connecting to anything possible
Connected to mEDBG CMSIS-DAP from Atmel (serial number ATML2795041800000764)
Debugger firmware version 1.13.43
Debugger hardware revision 0
Device mounted: 'attiny416'
Warning: you are attempting to use a device which is not the one which was mounted on the kit!
Cut all straps between the debugger and the on-board target when accessing an external device!
Pinging device...
Ping response: 1E9420
Reading...
Memory type: flash
---------------------------------------------------------
0x008000: 00 B0 00 00 00 00 00 02 00 00 30 44 3A 30 2D 33
0x008010: 4D 32 20 28 30 30 2E 35 39 42 31 35 2E 30 29 00
0x008020: 00 00 00 00 00 14 00 13 00 11 80 12 8A 12 20 94
0x008030: 00 00 00 00 FF 40 FF 40 FF 40 FF 40 FF 40 FF 40

0x008040: FF 40 FF 40 FF 40 FF 40 FF 40 FF 16 6B 5B 86 CF
0x008050: D3 27 15 B4 F7 2E 1A 9D 98 B7 7A B3 5A EE C0 66
0x008060: 77 8D A5 FE 16 90 02 06 20 97 29 A5 BA 7A C4 4B
0x008070: F4 71 2D 64 9C 55 4C 3C 04 D1 A8 6F 04 9F B7 7D

0x008080: 36 68 2C F1 8A E1 AD 2A 78 B2 27 3C A8 DA C4 02
0x008090: 08 F1 1E 06 52 28 F8 1B FF 2D 52 01 C3 70 BA 39
0x0080A0: E2 2B FE A1 61 97 59 D9 70 ED 5F F9 0B E7 4F 50
0x0080B0: AD B6 5D 90 D6 59 0A B4 E0 43 08 6B BE 6E C3 3A

0x0080C0: 82 33 FA 15 58 BA E7 03 A5 FC 5B 4C 73 BB 45 43
0x0080D0: 15 A0 BB FB F3 C3 06 5D 81 6B 1B CE CD 1E D2 C6
0x0080E0: 95 6D 67 DA 1B 45 20 DA 57 AE 0D 4E EF 84 6A D0
0x0080F0: 7A E2 B8 96 D1 D5 98 09 85 DF A4 CB C2 5F BB 75

0x008100: 2B A8 18 DB 4C 96 2C 8A 07 53 54 84 9C D0 B9 CA
0x008110: DF 38 E8 CB 04 4D A7 C8 C8 2A 58 F0 4E D5 21 3E
0x008120: 90 0D CA 7B F6 E9 FE 59 A9 08 52 51 E4 EF 12 95
0x008130: 3B 22 87 50 5E A5 6B A2 83 90 94 15 26 F7 DA A5

0x008140: 51 D1 41 7E E9 6C DE 5A 08 92 30 1E 9A F4 99 0D
0x008150: 11 49 7C CC 2E BA 9B 28 4D 1C 6F 2A 7A F7 FD DB
0x008160: C9 FD AC F1 63 D2 6B 0B 18 95 E7 52 6D B5 E7 2D
0x008170: 13 6B FD 91 CD 71 5C 88 5F 89 68 7E 44 D5 7D F5

0x008180: 95 72 07 82 C1 07 51 8F A4 10 86 87 2B 78 1F B3
0x008190: E9 87 A4 A1 9D 8B 45 78 68 40 EB B3 72 52 85 EE
0x0081A0: A0 0C 30 39 F7 4F DF 4B 90 59 07 AC C5 F4 1E B7
0x0081B0: 5C 45 84 3C 15 1C AB 4A F4 99 AD 47 5A 6D C4 15

0x0081C0: 79 4F B0 02 A2 DA 0C 1B 43 D0 64 AA 0A 74 89 95
0x0081D0: 55 5D 87 A4 07 8F 95 74 22 CB 0F 9D 2C D0 2C 6C
0x0081E0: 03 17 DA 5E 26 24 FF 21 9D 31 C1 2F 49 16 1E 40
0x0081F0: E2 59 4B 95 F4 71 34 40 A7 4C 5D A3 4C CB 00 59

0x008200: 00 B0 00 02 00 00 00 02 00 00 30 44 3A 30 2D 33
0x008210: 4D 32 20 28 30 30 2E 35 39 42 31 35 2E 30 29 00
0x008220: 00 00 00 00 00 14 00 13 00 11 80 12 8A 12 20 94
0x008230: 00 00 00 00 FF 40 FF 40 FF 40 FF 40 FF 40 FF 40

0x008240: FF 40 FF 40 FF 40 FF 40 FF 40 FF 16 6B 5B 86 CF
0x008250: D3 27 15 B4 F7 2E 1A 9D 98 B7 7A B3 5A EE C0 66
0x008260: 77 8D A5 FE 16 90 02 06 20 97 29 A5 BA 7A C4 4B
0x008270: F4 71 2D 64 9C 55 4C 3C 04 D1 A8 6F 04 9F B7 7D

[...]

So it's not empty. Also, please note that data is repeating every 0x0200 words. Data is not random, it's the same every time I read it.

Also, when reading the chip without specifying -m flash, read data in flash section is different from above:

Memory type: flash
---------------------------------------------------------
0x008000: 00 B0 00 00 00 00 00 02 00 00 FF FF FF FF FF FF
0x008010: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x008020: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x008030: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF

0x008040: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x008050: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x008060: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x008070: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF

0x008080: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x008090: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x0080A0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x0080B0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF

0x0080C0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x0080D0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x0080E0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x0080F0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF

0x008100: 00 A8 18 DB 4C 96 2C 8A 07 53 54 84 9C D0 B9 CA
0x008110: DF 38 E8 CB 04 4D A7 C8 C8 2A 58 F0 4E D5 21 3E
0x008120: 90 0D CA 7B F6 E9 FE 59 A9 08 52 51 E4 EF 12 95
0x008130: 3B 22 87 50 5E A5 6B A2 83 90 94 15 26 F7 DA A5

0x008140: 51 D1 41 7E E9 6C DE 5A 08 92 30 1E 9A F4 99 0D
0x008150: 11 49 7C CC 2E BA 9B 28 4D 1C 6F 2A 7A F7 FD DB
0x008160: C9 FD AC F1 63 D2 6B 0B 18 95 E7 52 6D B5 E7 2D
0x008170: 13 6B FD 91 CD 71 5C 88 5F 89 68 7E 44 D5 7D F5

0x008180: 95 72 07 82 C1 07 51 8F A4 10 86 87 2B 78 1F B3
0x008190: E9 87 A4 A1 9D 8B 45 78 68 40 EB B3 72 52 85 EE
0x0081A0: A0 0C 30 39 F7 4F DF 4B 90 59 07 AC C5 F4 1E B7
0x0081B0: 5C 45 84 3C 15 1C AB 4A F4 99 AD 47 5A 6D C4 15

0x0081C0: 79 4F B0 02 A2 DA 0C 1B 43 D0 64 AA 0A 74 89 95
0x0081D0: 55 5D 87 A4 07 8F 95 74 22 CB 0F 9D 2C D0 2C 6C
0x0081E0: 03 17 DA 5E 26 24 FF 21 9D 31 C1 2F 49 16 1E 40
0x0081F0: E2 59 4B 95 F4 71 34 40 A7 4C 5D A3 4C CB 00 59

0x008200: 00 B0 00 02 00 00 00 02 00 00 FF FF FF FF FF FF
0x008210: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x008220: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x008230: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF

It reads this config, which is correct, what I have set in the IDE:

Memory type: lockbits
---------------------------------------------------------
0x001280: xx xx xx xx xx xx xx xx xx xx C5 xx xx xx xx xx (chip unlocked)
---------------------------------------------------------
Memory type: fuses
---------------------------------------------------------
0x001280: 00 00 01 00 00 C4 07 00 00 xx xx xx xx xx xx xx
---------------------------------------------------------

I've spent two full days in this already.
Any ideas? Is there a way to upgrade debugger firmware on this devboard?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions