Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong target signature (ATtiny416) #107

Open
fakr00n opened this issue Apr 15, 2024 · 3 comments
Open

Wrong target signature (ATtiny416) #107

fakr00n opened this issue Apr 15, 2024 · 3 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@fakr00n
Copy link

fakr00n commented Apr 15, 2024

I'm using the ATTINY416 XPLAINED NANO board. The board stopped working with bloom for some odd reason (it was working fine yesteraday).

Here is the bloom debug output

2024-04-15 17:56:05.907 CEST [MT]: [DEBUG] Debug log printing has been enabled
2024-04-15 17:56:05.907 CEST [MT]: [DEBUG] Bloom version: 1.0.0
2024-04-15 17:56:05.907 CEST [MT]: [INFO] Selected environment: "default"
2024-04-15 17:56:05.907 CEST [MT]: [DEBUG] Number of environments extracted from config: 1
2024-04-15 17:56:05.907 CEST [SH]: [DEBUG] Starting SignalHandler
2024-04-15 17:56:05.907 CEST [TC]: [INFO] Starting TargetController
2024-04-15 17:56:05.907 CEST [SH]: [DEBUG] SignalHandler ready
2024-04-15 17:56:05.934 CEST [TC]: [INFO] Connecting to debug tool
2024-04-15 17:56:05.964 CEST [TC]: [DEBUG] HID device path: 7-2.4.4.2.2:1.0
2024-04-15 17:56:06.009 CEST [TC]: [INFO] Debug tool connected
2024-04-15 17:56:06.009 CEST [TC]: [INFO] Debug tool name: Xplained Nano
2024-04-15 17:56:06.049 CEST [TC]: [INFO] Debug tool serial: ATML2795042700004593
2024-04-15 17:56:06.050 CEST [TC]: [DEBUG] Loading AVR8 target description file: /opt/bloom/bin/../resources/TargetDescriptionFiles/AVR/AVR8/TINY/ATTINY416.xml
2024-04-15 17:56:06.071 CEST [TC]: [DEBUG] Failed to extract memory segment from target description element - Unknown type: "other"
2024-04-15 17:56:06.071 CEST [TC]: [DEBUG] Failed to extract memory segment from target description element - Unknown type: "user_signatures"
2024-04-15 17:56:06.077 CEST [TC]: [INFO] Activating target
2024-04-15 17:56:06.121 CEST [TC]: [DEBUG] Setting AVR8 EDBG parameter (context: 0x01, id: 0x31, value: 0x0807)
2024-04-15 17:56:06.161 CEST [TC]: [DEBUG] Setting AVR8 EDBG parameter (context: 0x03, id: 0x06, value: 0x00)
2024-04-15 17:56:06.201 CEST [TC]: [DEBUG] Setting AVR8 EDBG parameter (context: 0x00, id: 0x00, value: 0x05)
2024-04-15 17:56:06.241 CEST [TC]: [DEBUG] Setting AVR8 EDBG parameter (context: 0x00, id: 0x01, value: 0x02)
2024-04-15 17:56:06.281 CEST [TC]: [DEBUG] Setting AVR8 EDBG parameter (context: 0x01, id: 0x00, value: 0x08)
2024-04-15 17:56:06.281 CEST [TC]: [DEBUG] Setting UPDI_PROGMEM_BASE_ADDR AVR8 device parameter
2024-04-15 17:56:06.321 CEST [TC]: [DEBUG] Setting AVR8 EDBG parameter (context: 0x02, id: 0x00, value: 0x0080)
2024-04-15 17:56:06.321 CEST [TC]: [DEBUG] Setting UPDI_PROGMEM_BASE_ADDR_MSB AVR8 device parameter
2024-04-15 17:56:06.361 CEST [TC]: [DEBUG] Setting AVR8 EDBG parameter (context: 0x02, id: 0x2c, value: 0x00)
2024-04-15 17:56:06.361 CEST [TC]: [DEBUG] Setting UPDI_FLASH_PAGE_SIZE AVR8 device parameter
2024-04-15 17:56:06.401 CEST [TC]: [DEBUG] Setting AVR8 EDBG parameter (context: 0x02, id: 0x02, value: 0x40)
2024-04-15 17:56:06.401 CEST [TC]: [DEBUG] Setting UPDI_FLASH_PAGE_SIZE_MSB AVR8 device parameter
2024-04-15 17:56:06.441 CEST [TC]: [DEBUG] Setting AVR8 EDBG parameter (context: 0x02, id: 0x2d, value: 0x00)
2024-04-15 17:56:06.441 CEST [TC]: [DEBUG] Setting UPDI_EEPROM_PAGE_SIZE AVR8 device parameter
2024-04-15 17:56:06.481 CEST [TC]: [DEBUG] Setting AVR8 EDBG parameter (context: 0x02, id: 0x03, value: 0x20)
2024-04-15 17:56:06.481 CEST [TC]: [DEBUG] Setting UPDI_NVMCTRL_ADDR AVR8 device parameter
2024-04-15 17:56:06.521 CEST [TC]: [DEBUG] Setting AVR8 EDBG parameter (context: 0x02, id: 0x04, value: 0x0010)
2024-04-15 17:56:06.521 CEST [TC]: [DEBUG] Setting UPDI_OCD_ADDR AVR8 device parameter
2024-04-15 17:56:06.561 CEST [TC]: [DEBUG] Setting AVR8 EDBG parameter (context: 0x02, id: 0x06, value: 0x800f)
2024-04-15 17:56:06.561 CEST [TC]: [DEBUG] Setting UPDI_FLASH_SIZE AVR8 device parameter
2024-04-15 17:56:06.601 CEST [TC]: [DEBUG] Setting AVR8 EDBG parameter (context: 0x02, id: 0x12, value: 0x00100000)
2024-04-15 17:56:06.601 CEST [TC]: [DEBUG] Setting UPDI_EEPROM_SIZE AVR8 device parameter
2024-04-15 17:56:06.641 CEST [TC]: [DEBUG] Setting AVR8 EDBG parameter (context: 0x02, id: 0x16, value: 0x8000)
2024-04-15 17:56:06.641 CEST [TC]: [DEBUG] Setting UPDI_EEPROM_BASE_ADDR AVR8 device parameter
2024-04-15 17:56:06.681 CEST [TC]: [DEBUG] Setting AVR8 EDBG parameter (context: 0x02, id: 0x20, value: 0x0014)
2024-04-15 17:56:06.681 CEST [TC]: [DEBUG] Setting UPDI_SIG_BASE_ADDR AVR8 device parameter
2024-04-15 17:56:06.721 CEST [TC]: [DEBUG] Setting AVR8 EDBG parameter (context: 0x02, id: 0x24, value: 0x0011)
2024-04-15 17:56:06.721 CEST [TC]: [DEBUG] Setting UPDI_FUSE_BASE_ADDR AVR8 device parameter
2024-04-15 17:56:06.761 CEST [TC]: [DEBUG] Setting AVR8 EDBG parameter (context: 0x02, id: 0x26, value: 0x8012)
2024-04-15 17:56:06.761 CEST [TC]: [DEBUG] Setting UPDI_FUSE_SIZE AVR8 device parameter
2024-04-15 17:56:06.801 CEST [TC]: [DEBUG] Setting AVR8 EDBG parameter (context: 0x02, id: 0x1a, value: 0x0a00)
2024-04-15 17:56:06.801 CEST [TC]: [DEBUG] Setting UPDI_LOCK_BASE_ADDR AVR8 device parameter
2024-04-15 17:56:06.841 CEST [TC]: [DEBUG] Setting AVR8 EDBG parameter (context: 0x02, id: 0x28, value: 0x8a12)
2024-04-15 17:56:06.881 CEST [TC]: [DEBUG] Setting AVR8 EDBG parameter (context: 0x02, id: 0x2e, value: 0x00)
2024-04-15 17:56:07.369 CEST [TC]: [ERROR] The TargetController encountered a fatal error. See below for errors:
2024-04-15 17:56:07.369 CEST [TC]: [ERROR] Failed to validate connected target - target signature mismatch.
The target signature ("0x552400") does not match the AVR8 target description signature ("0x1e9221"). This will likely be due to an incorrect target name in the configuration file (bloom.yaml).
2024-04-15 17:56:07.369 CEST [TC]: [INFO] Shutting down TargetController
2024-04-15 17:56:07.369 CEST [TC]: [INFO] Deactivating target
2024-04-15 17:56:07.529 CEST [TC]: [INFO] Closing debug tool
2024-04-15 17:56:07.570 CEST [TC]: [DEBUG] Event "TargetControllerThreadStateChanged" (1) registered for listener ApplicationEventListener
2024-04-15 17:56:07.570 CEST [MT]: [ERROR] TargetController failed to start up
2024-04-15 17:56:07.570 CEST [MT]: [INFO] Shutting down Bloom
2024-04-15 17:56:07.570 CEST [MT]: [DEBUG] Joining TargetController thread
2024-04-15 17:56:07.570 CEST [MT]: [DEBUG] TargetController thread joined
2024-04-15 17:56:07.570 CEST [MT]: [DEBUG] Joining SignalHandler thread
2024-04-15 17:56:07.570 CEST [SH]: [DEBUG] SIGNAL 10 received
2024-04-15 17:56:07.570 CEST [SH]: [INFO] Shutting down SignalHandler
2024-04-15 17:56:07.571 CEST [MT]: [DEBUG] SignalHandler thread joined
2024-04-15 17:56:07.571 CEST [MT]: [DEBUG] Saving project settings to /home/fakr00n/Documents/git/develop/agribot/tower/.bloom/settings.json

For some reason bloom reads the target signature 0x552400 instead of 0x1e9221 which is of course wrong. I have no problem reading the target signature with AVRDude (it reads the correct sig 0x1e9221) . I have no problems using AVRDude for flashing, reading flash etc... In other words, No problems with the board.

I have erased flash before running bloom (and AVRDude) just in case to rule out that my firmware was messing with the RESET/UPDI pin (I have double checked it was erased by reading it back with AVRdude). Still same problem.

Here is my bloom.yaml

debugLogging: true
environments:
  default:
    shutdownPostDebugSession: true

    tool:
      name: "xplained-nano"

    target:
      name: "attiny416"
      physicalInterface: "updi"
      hardwareBreakpoints: true

    server:
      name: "avr-gdb-rsp"
      ipAddress: "127.0.0.1"
      port: 1442
      rangeStepping: true

insight:
  activateOnStartup: false
  shutdownOnClose: true

Here is the output of AVRdude (read signature)

avrdude -p attiny416 -c xplainedmini_updi -P usb -U signature:r:-:h

avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x1e9221 (probably t416)

avrdude: processing -U signature:r:-:h
avrdude: reading signature memory ...
avrdude: writing output file <stdout>
0x1e,0x92,0x21

avrdude done.  Thank you.
@navnavnav
Copy link
Member

Hello @fakr00n

As it happens, I have that very same board and just attempted to replicate the issue. As you experienced, Bloom worked fine initially, but then after attempting to perform a chip erase via avrdude, Bloom began to fail. I suspect the chip erase has resulted in some unintended side effect.

After a little digging, I've found that resetting the target after activating the physical interface and before the signature validation check seems to resolve the issue. Bloom already does this, but only after signature validation. Reading the target signature before the reset results in the garbage data, but it works fine after.

I've prepared an unofficial build, v1.0.2, for you. This build will reset the target immediately after activation and before the signature validation check.

DEB: https://bloom-public-bucket.s3.eu-west-1.amazonaws.com/Bloom-1.0.2-Linux-x86_64.deb
RPM: https://bloom-public-bucket.s3.eu-west-1.amazonaws.com/Bloom-1.0.2-Linux-x86_64.rpm
PKGBUILD: https://bloom-public-bucket.s3.eu-west-1.amazonaws.com/Bloom-1.0.2-Linux-x86_64.pkg.tar.gz

Please let me know if this fixes the issue.

I will include this change in the next release, but it won't be published for quite some time as I'm currently knee-deep in a large refactor for RISC-V support.

@fakr00n
Copy link
Author

fakr00n commented Apr 16, 2024

Hi,
Thank you for your quick fix. It's working perfectly now :)
Good luck with RISC-V support and thank you for such a useful software!

@navnavnav
Copy link
Member

Excellent, thanks for confirming. I will close this ticket once I've added the same change to the master branch.

@navnavnav navnavnav self-assigned this Apr 20, 2024
@navnavnav navnavnav added the bug Something isn't working label Apr 20, 2024
@navnavnav navnavnav added this to the v1.1.0 milestone Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants