cpu/atmega32u4: Fixed external interrupts; boards/arduino-leonardo: Fixed dependency tracking#11927
Conversation
Currently the configuration claims that external interrupt INT4 is present on pin PE7. However, the ATmega32U4 datasheet (section 10.3.4 page 81) contains the following remark to pin PE7: "Not present on pin-out". This commit removes the PE7 from the interrupt config.
Somehow Makefile.dep was missing on the Arduino Leonardo. This commit adds it.
|
@miri64: Mind to review? (I know, not your field of interest. But you have a board and this PR is quite small ;-)) |
|
I'll have a look next week. My leonardo is at the office. If I don't come back to this on Monday, please feel free to remind me ;-). |
Sorry, had no internet today in the office. In the meantime: a more descriptive PR title would be appreciated ;-) |
miri64
left a comment
There was a problem hiding this comment.
I tried to test this and was able to flash and run hello world, however after that I was not able to flash anymore (/dev/ttyACM0 disappearing during flashing)… I'm not sure if it was this PR that effectively bricked it :-/. So I rather prefer someone else to have a look at this. I can confirm however, that PE7 is not exposed to the pinout (see datasheet, section 10.3.4)
Can you provide more details? Upon boot the bootloader of the Leonardo provides So the most reliable way to flash is using the following steps:
That is very unlikely. Only the bootloader in the AVR should be able to write to the flash, so unless some advanced hack to work around this protection is used, RIOT (or any other firmware flashed via the bootloader) will not be able to brick the device. I heard that some people still had to rewrite the bootloader of an Arduino. The only plausible explanation to me is that a hard to trigger bug in the bootloader can cause it to overwrite/modify portions of itself. |
|
@miri64: Time to give this another try? If the Leonardo's bootloader was indeed somehow bricked, you can just flash it using an ISP or a second Arduino as ISP. But again: Bricking the bootloader is theoretically impossible from RIOT, only the bootloader itself has write access to the flash. But I cannot rule out that some bug in the bootloader was triggered somehow :-/ |
|
Thanks, I'll try that! |
|
Ok, after burning the bootloader via an Arduino Uno as ISP, /dev/ttyACM0 does not disappear anymore after a few seconds (which was my problem) I will now test your PR :-) |
miri64
left a comment
There was a problem hiding this comment.
Ok, I still get the error occasionally, but I am confident that this has nothing to do with your PR as I observe the same behavior with a freshly burned bootloader on master and get similar output when flashing a sketch with the Arduino IDE as well... I think my poor Leonardo is just on the last leg of its life :( (it's quite old and rusty):
BOARD=arduino-leonardo make -C tests/periph_timer/ flash-only
avrdude -c avr109 -p m32u4 -P /dev/ttyACM0 -F -D -U flash:w:/home/mlenders/Repositories/RIOT-OS/RIOT/tests/periph_timer/bin/arduino-leonardo/tests_periph_timer.hex
Connecting to programmer: .
Found programmer: Id = "CATERIN"; type = S
Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.
Programmer supports the following devices:
Device code: 0x44
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: reading input file "/home/mlenders/Repositories/RIOT-OS/RIOT/tests/periph_timer/bin/arduino-leonardo/tests_periph_timer.hex"
avrdude: input file /home/mlenders/Repositories/RIOT-OS/RIOT/tests/periph_timer/bin/arduino-leonardo/tests_periph_timer.hex auto detected as Intel Hex
avrdude: writing flash (6760 bytes):
Writing | ################################################## | 100% 0.81s
avrdude: 6760 bytes of flash written
avrdude: verifying flash memory against /home/mlenders/Repositories/RIOT-OS/RIOT/tests/periph_timer/bin/arduino-leonardo/tests_periph_timer.hex:
avrdude: load data flash data from input file /home/mlenders/Repositories/RIOT-OS/RIOT/tests/periph_timer/bin/arduino-leonardo/tests_periph_timer.hex:
avrdude: input file /home/mlenders/Repositories/RIOT-OS/RIOT/tests/periph_timer/bin/arduino-leonardo/tests_periph_timer.hex auto detected as Intel Hex
avrdude: input file /home/mlenders/Repositories/RIOT-OS/RIOT/tests/periph_timer/bin/arduino-leonardo/tests_periph_timer.hex contains 6760 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.05s
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x1800
0xff != 0x0f
avrdude: verification error; content mismatch
avrdude: safemode: Verify error - unable to read lfuse properly. Programmer may not be reliable.
avrdude: safemode: Sorry, reading back fuses was unreliable. I have given up and exited programming mode
avrdude: error: programmer did not respond to command: leave prog mode
and after that I get mostly this
make: Entering directory '/home/mlenders/Repositories/RIOT-OS/RIOT/tests/periph_timer'
avrdude -c avr109 -p m32u4 -P /dev/ttyACM0 -F -D -U flash:w:/home/mlenders/Repositories/RIOT-OS/RIOT/tests/periph_timer/bin/arduino-leonardo/tests_periph_timer.hex
Connecting to programmer: .
Found programmer: Id = "CATERIN"; type = S
Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.
Programmer supports the following devices:
Device code: 0x44
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: reading input file "/home/mlenders/Repositories/RIOT-OS/RIOT/tests/periph_timer/bin/arduino-leonardo/tests_periph_timer.hex"
avrdude: input file /home/mlenders/Repositories/RIOT-OS/RIOT/tests/periph_timer/bin/arduino-leonardo/tests_periph_timer.hex auto detected as Intel Hex
avrdude: writing flash (6760 bytes):
Writing | ############################################## | 92% 0.46savrdude: error: programmer did not respond to command: set addr
avrdude: error: programmer did not respond to command: write block
Writing | ############################################### | 94% 0.46s ***failed;
***failed;
***failed;
[…]
***failed;
avrdude: Error: butterfly programmer uses avr_write_page() but does not
provide a cmd() method.
*** page 103 (addresses 0x19e8 - 0x1a67) failed to write
Writing | ################################################## | 100% 0.52s
avrdude: 6760 bytes of flash written
avrdude: verifying flash memory against /home/mlenders/Repositories/RIOT-OS/RIOT/tests/periph_timer/bin/arduino-leonardo/tests_periph_timer.hex:
avrdude: load data flash data from input file /home/mlenders/Repositories/RIOT-OS/RIOT/tests/periph_timer/bin/arduino-leonardo/tests_periph_timer.hex:
avrdude: input file /home/mlenders/Repositories/RIOT-OS/RIOT/tests/periph_timer/bin/arduino-leonardo/tests_periph_timer.hex auto detected as Intel Hex
avrdude: input file /home/mlenders/Repositories/RIOT-OS/RIOT/tests/periph_timer/bin/arduino-leonardo/tests_periph_timer.hex contains 6760 bytes
avrdude: reading on-chip flash data:
Reading | | 0% 0.00savrdude: error: programmer did not respond to command: set addr
Reading | # | 1% 0.00savrdude: error: programmer did not respond to command: set addr
Reading | ## | 3% 0.00savrdude: error: programmer did not respond to command: set addr
Reading | ### | 5% 0.00savrdude: error: programmer did not respond to command: set addr
[…]
Reading | ################################################ | 96% 0.05savrdude: error: programmer did not respond to command: set addr
Reading | ################################################# | 98% 0.05savrdude: error: programmer did not respond to command: set addr
Reading | ################################################## | 100% 0.05s
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
0x3f != 0x0c
avrdude: verification error; content mismatch
avrdude: safemode: hfuse changed! Was d8, and is now ff
Would you like this fuse to be changed back? [y/n] y
ding | ################################################ | 96% 0.05savrdude: error: programmer did not respond to command: set addr
Reading | ################################################# | 98% 0.05savrdude: error: programmer did not respond to command: set addr
Reading | ################################################## | 100% 0.05s
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
0x3f != 0x0c
avrdude: verification error; content mismatch
avrdude: safemode: hfuse changed! Was d8, and is now ff
Would you like this fuse to be changed back? [y/n] y
^Cmake: *** [/home/mlenders/Repositories/RIOT-OS/RIOT/tests/periph_timer/../../Makefile.include:562: flash-only] Interrupt
However, I was able to confirm all the steps in your testing procedures. ACK.
|
Thanks for review! |
Contribution description
Testing procedure
make BOARD=arduino-leonardo info-modulese.g. inexamples/hello_worldshould now listboards_common_arduino-atmegaIssues/PRs references
Found bug while testing #11923