Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix ArduinoISP sketch for Uno WiFi Rev2#2

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
per1234 wants to merge1 commit intoarduino:main
base:main
Choose a base branch
Loading
fromper1234:fix-arduinoisp-for-uno-wifi-rev2
Open

Fix ArduinoISP sketch for Uno WiFi Rev2#2

per1234 wants to merge1 commit intoarduino:mainfromper1234:fix-arduinoisp-for-uno-wifi-rev2

Conversation

per1234
Copy link
Contributor

@per1234per1234 commentedSep 2, 2020
edited
Loading

When using bit banged SPI, which the sketch did when compiled for any architecture other than AVR, aSPISettings class was declared by the sketch. At the time the sketch was written, it was reasonable to expect this would not cause a name collision, since SPI.h is not#included when doing bit banged SPI. However, since then aSPISettings class has been declared inArduinoCore-API's HardwareSPI.h, causing the ArduinoISP sketch tonot compile for any board whose core uses ArduinoCoreAPI (currentlyArduino Mega AVR Boards, "Arduino nRF528x Boards (Mbed OS)", and "Arduino Mbed OS Boards (nRF52840 / STM32H747)"):

  /github/workspace/examples/11.ArduinoISP/ArduinoISP/ArduinoISP.ino:191:27: error: reference to 'SPISettings' is ambiguous       void beginTransaction(SPISettings settings) {                             ^~~~~~~~~~~  /github/workspace/examples/11.ArduinoISP/ArduinoISP/ArduinoISP.ino:167:7: note: candidates are: class SPISettings   class SPISettings {         ^~~~~~~~~~~  In file included from /github/home/.arduino15/packages/arduino/hardware/megaavr/1.8.6/cores/arduino/api/ArduinoAPI.h:31:0,                   from /github/home/.arduino15/packages/arduino/hardware/megaavr/1.8.6/cores/arduino/Arduino.h:23,                   from /github/workspace/examples/11.ArduinoISP/ArduinoISP/ArduinoISP.ino:39:  /github/home/.arduino15/packages/arduino/hardware/megaavr/1.8.6/cores/arduino/api/HardwareSPI.h:37:7: note:                 class arduino::SPISettings   class SPISettings {         ^~~~~~~~~~~

Although it's easy enough to fix the name collision (#3), it seemed a better idea to simply use hardware SPI when compiling for the megaAVR architecture.


After this change, I was able to use the Uno WiFi Rev2 as an "Arduino as ISP" programmer with "Burn Bootloader" and "Upload Using Programmer". It is necessary to use theTools > Programmer > Arduino as ISP (ATmega32U4).


Unfortunately, I found that, although the sketch compiles, I still can't use the Nano Every as an "Arduino as ISP" programmer. It is able to read the chip signature and read and write fuses, but there areavrdude: stk500_recv(): programmer is not responding errors while writing the program to flash.

I found that the same issue occurs if I use the Nano Every and Nano 33 BLE with the bit banged SPI code (after fixing the name collision), while the Uno WiFi Rev2 works fine with the bit banged SPI.

@per1234per1234 added the type: imperfectionPerceived defect in any part of project labelSep 2, 2020
@ubidefeo
Copy link
Contributor

@per1234
I'm fairly sure it's a timing issue.
For the Nano Every and WiFi Rev2, could this be related to the 4809's AVR registry emulation?
For the 33 BLE we'll have to drag Martino in, I guess

@per1234
Copy link
ContributorAuthor

I think it must be. I tried it both with and without the ATmega328 emulation enabled for both boards and I got the same result (Uno WiFi Rev2 always works, Nano Every always fails).

When I use a SAMD board, either with the release version of the platform, or a beta version that has ArduinoCore-API integration, it works.

@per1234
Copy link
ContributorAuthor

per1234 commentedSep 3, 2020
edited
Loading

The CI didn't run on the PR because the repo is private, but you can see the jobs here:
https://github.com/per1234/arduino-examples/actions/runs/239053006

When using bitbanged SPI, which the sketch did when compiled for any architecture other than AVR, a SPISettings class was declared by the sketch. At the time the sketch was written, it was reasonable to expect this would not cause a name collision, since SPI.h is not `#include`d when doing bit banged SPI. However, since then a SPISettings class has been declared in ArduinoCore-API's HardwareSPI.h, causing the ArduinoISP sketch to not compile for any board whose core uses ArduinoCoreAPI (currently Arduino Mega AVR Boards, "Arduino nRF528x Boards (Mbed OS)", and "Arduino Mbed OS Boards (nRF52840 / STM32H747)"):```  /github/workspace/examples/11.ArduinoISP/ArduinoISP/ArduinoISP.ino:191:27: error: reference to 'SPISettings' is ambiguous       void beginTransaction(SPISettings settings) {                             ^~~~~~~~~~~  /github/workspace/examples/11.ArduinoISP/ArduinoISP/ArduinoISP.ino:167:7: note: candidates are: class SPISettings   class SPISettings {         ^~~~~~~~~~~  In file included from /github/home/.arduino15/packages/arduino/hardware/megaavr/1.8.6/cores/arduino/api/ArduinoAPI.h:31:0,                   from /github/home/.arduino15/packages/arduino/hardware/megaavr/1.8.6/cores/arduino/Arduino.h:23,                   from /github/workspace/examples/11.ArduinoISP/ArduinoISP/ArduinoISP.ino:39:  /github/home/.arduino15/packages/arduino/hardware/megaavr/1.8.6/cores/arduino/api/HardwareSPI.h:37:7: note:                 class arduino::SPISettings   class SPISettings {         ^~~~~~~~~~~```Although it's easy enough to fix the name collision, it seemed a better idea to simply use hardware SPI when compiling for the megaAVR architecture.---After this change, I was able to use the Uno WiFi Rev2 as an "Arduino as ISP" programmer with "Burn Bootloader" and "Upload Using Programmer". It is necessary to use the **Tools > Programmer > Arduino as ISP (ATmega32U4)** programmer selection.---Unfortunately, I found that, although the sketch now compiles for that board, I still can't use the Nano Every as an "Arduino as ISP" programmer. It is able to read the chip signature and read and write fuses, but there are `avrdude: stk500_recv(): programmer is not responding` errors while writing the program to flash.I found that the same issue occurs if I use the Nano Every and Nano 33 BLE with the bit banged SPI code (after fixing the name collision), while the Uno WiFi Rev2 works fine with the bit banged SPI.
@per1234per1234 added bug and removed bug labelsOct 20, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
type: imperfectionPerceived defect in any part of project
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@per1234@ubidefeo

[8]ページ先頭

©2009-2025 Movatter.jp