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

rp2040 earlephilhower library compatibility #123

Open
joyfab opened this issue Dec 6, 2022 · 9 comments
Open

rp2040 earlephilhower library compatibility #123

joyfab opened this issue Dec 6, 2022 · 9 comments

Comments

@joyfab
Copy link

joyfab commented Dec 6, 2022

Description

RP2040 (Raspberry pi pico) earlephilhower library) compatibility problem:
warning "OneWire. Fallback mode. Using API calls for pinMode,digitalRead and digitalWrite. Operation of this library is not guaranteed on this architecture.
Right!. No way to run. Don't wire any gpio. Run only on mbedRP2040 boards.

Steps Fix the Problem

open OneWire_direct_gpio.h.
just write line 445 at place of #define PIN_TO_BASEREG(pin) (0)
by #define PIN_TO_BASEREG(pin) (pin)
comment boths warning (line 442 and 455 (//#warning ("OneWire. Fallback mode...
it's work like a charm on any gpio of the Pico, Pico-Zero, and Pico W
with earlephilhower library on Arduino IDE 1.8.19...;)

Hardware & Software

Raspberry pi pico, W, and Zero.
Arduino IDE version 1.8.19 with earlephilhower library.
Version 2.6.3 https://github.com/earlephilhower/arduino-pico
Operating system
MacOS Sierra

use at the top #include <Arduino.h> and #include <DallasTemperature.h> for the sketch.
you can use any library from Arduino, it run with..

@brentru
Copy link

brentru commented Dec 9, 2022

The https://github.com/pstolarz/OneWireNg library does support RP2040 platforms, you may want to try that instead.

@joyfab
Copy link
Author

joyfab commented Dec 10, 2022 via email

@joyfab
Copy link
Author

joyfab commented Dec 10, 2022 via email

@witzed1
Copy link

witzed1 commented Feb 16, 2023

Thanks for this information. I'm almost a novice so can you tell me once I open and edit the Onewire_direct_gpio.h file, How I then call it in a sketch. There is no install option listed for this library in Arduino 2.0.3. Thanks

@chandradharkoneti
Copy link

I am having issues too. My PICO is completely becoming un-usable until I flash Nuke it.

I have tried the following boards and libraries.
Boards:

  • Raspberry Pi Pico/RP2040 (Earle F. Philhower, III) - v3.2.1
  • Arduino MBED OS RP2040 Boards (Arduino) - v4.0.2

Libraries:

  • OneWire - v2.3.5 and v2.3.7
  • DallasTemperature - v3.8.0 and v3.9.0
  • Arduino_Unified_Sensor - v1.1.9

None of them work. Please read further for output logs and windows error when my PICO bricks.

I have attached the code in a zip file.
This is compilation and upload warning(Earle_Philhower board): Raspberry Pi Pico/RP2040 (Earle F. Philhower, III) - v3.2.1 ; OneWire - v2.3.7

In file included from D:\Dropbox\ARDUINO\INO files\libraries\OneWire\OneWire.cpp:144:
D:\Dropbox\ARDUINO\INO files\libraries\OneWire\util/OneWire_direct_gpio.h:441:2: warning: #warning "OneWire. Fallback mode. Using API calls for pinMode,digitalRead and digitalWrite. Operation of this library is not guaranteed on this architecture." [-Wcpp]
  441 | #warning "OneWire. Fallback mode. Using API calls for pinMode,digitalRead and digitalWrite. Operation of this library is not guaranteed on this architecture."
      |  ^~~~~~~
Sketch uses 55548 bytes (2%) of program storage space. Maximum is 2093056 bytes.
Global variables use 9056 bytes (3%) of dynamic memory, leaving 253088 bytes for local variables. Maximum is 262144 bytes.
Resetting COM15
Converting to uf2, output size: 144384, start address: 0x2000
Scanning for RP2040 devices
Flashing F: (RPI-RP2)
Wrote 144384 bytes to F:/NEW.UF2

A similar message is being displayed for Arduino MBED OS RP2040 Boards (Arduino) - v4.0.2.

Arduino MBED OS RP2040 Boards (Arduino) - v4.0.2 ; OneWire - v2.3.5

In file included from D:\Dropbox\ARDUINO\INO files\libraries\OneWire\OneWire.cpp:144:
D:\Dropbox\ARDUINO\INO files\libraries\OneWire\util/OneWire_direct_gpio.h:416:2: warning: #warning "OneWire. Fallback mode. Using API calls for pinMode,digitalRead and digitalWrite. Operation of this library is not guaranteed on this architecture." [-Wcpp]
  416 | #warning "OneWire. Fallback mode. Using API calls for pinMode,digitalRead and digitalWrite. Operation of this library is not guaranteed on this architecture."
      |  ^~~~~~~
Sketch uses 55412 bytes (2%) of program storage space. Maximum is 2093056 bytes.
Global variables use 9052 bytes (3%) of dynamic memory, leaving 253092 bytes for local variables. Maximum is 262144 bytes.

I have tried with Earle F Philhower's board as well as Arduino Original: MBED_OS_RP2040 board.

Both of them are causing my board to brick. Windows fails to recognise the device.
USB_Malfunction

NEW_DS18B20.zip

@chandradharkoneti
Copy link

Description

RP2040 (Raspberry pi pico) earlephilhower library) compatibility problem: warning "OneWire. Fallback mode. Using API calls for pinMode,digitalRead and digitalWrite. Operation of this library is not guaranteed on this architecture. Right!. No way to run. Don't wire any gpio. Run only on mbedRP2040 boards.

Steps Fix the Problem

open OneWire_direct_gpio.h. just write line 445 at place of #define PIN_TO_BASEREG(pin) (0) by #define PIN_TO_BASEREG(pin) (pin) comment boths warning (line 442 and 455 (//#warning ("OneWire. Fallback mode... it's work like a charm on any gpio of the Pico, Pico-Zero, and Pico W with earlephilhower library on Arduino IDE 1.8.19...;)

Hardware & Software

Raspberry pi pico, W, and Zero. Arduino IDE version 1.8.19 with earlephilhower library. Version 2.6.3 https://github.com/earlephilhower/arduino-pico Operating system MacOS Sierra

use at the top #include <Arduino.h> and #include <DallasTemperature.h> for the sketch. you can use any library from Arduino, it run with..

I have tried the above suggestion, but It is failing to compile.

In file included from D:\Dropbox\ARDUINO\INO files\libraries\OneWire\OneWire.cpp:144:
D:\Dropbox\ARDUINO\INO files\libraries\OneWire\OneWire.cpp: In member function 'void OneWire::begin(uint8_t)':
D:\Dropbox\ARDUINO\INO files\libraries\OneWire\OneWire.cpp:151:27: error: invalid conversion from 'uint8_t' {aka 'unsigned char'} to 'volatile unsigned int*' [-fpermissive]
  151 |  baseReg = PIN_TO_BASEREG(pin);
D:\Dropbox\ARDUINO\INO files\libraries\OneWire\util/OneWire_direct_gpio.h:431:42: note: in definition of macro 'PIN_TO_BASEREG'
  431 | #define PIN_TO_BASEREG(pin)             (pin)
      |                                          ^~~
Multiple libraries were found for "OneWire.h"
 Used: D:\Dropbox\ARDUINO\INO
 Not used: D:\Dropbox\ARDUINO\INO
Multiple libraries were found for "DallasTemperature.h"
 Used: D:\Dropbox\ARDUINO\INO
Multiple libraries were found for "Adafruit_Sensor.h"
 Used: D:\Dropbox\ARDUINO\INO
Multiple libraries were found for "DHT.h"
 Used: D:\Dropbox\ARDUINO\INO
exit status 1
Error compiling for board Raspberry Pi Pico.

I have searched the folder it mentioned and any other folders where libraries may be stored, but there are no duplicates of the libraries.

@joyfab
Copy link
Author

joyfab commented May 31, 2023

Sure you have mutiple OneWire libraries (Multiple libraries were found for "OneWire.h") so it's not the good one. uninstall all OneWire libraries firth included AdaFruit_sensor may be it have. then install PaulStoffregen OneWire library.(https://github.com/PaulStoffregen) and verify this is the only one. Dont modify anything (bug has been corrected).
run dallas to check it. I work on mac but you can run windows same. If your RP2040 dont want to mount on usb UF2, you have to reboot it and re-write any correct code cause you have corrupted the firmware. It's not dead.

@chandradharkoneti
Copy link

I have manually searched for the OneWire library's duplicate. I haven't found it anywhere(Including in any of adafruit/other third party libraries).
Anyhow, I'll try uninstalling Adafruit_Sensor library and let you know if that works.

But Adafruit library is needed for a lot of my codes.

@PaulStoffregen
Copy link
Owner

Click File > Preferences and turn on verbose output during compilation. This will cause Arduino IDE to show the full pathnames of all libraries used. It will also show all the compiler commands (a lot of text) which have the full pathnames to files used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants