Closed jludwig75 closed 3 years ago
Hi @jludwig75
Try adding #include "HardwareSerial.h"
above the top of your sketch
Are you trying to use on nrf52 locally or an external nrf52? The native is for on chip, the serial for external chips such as the D52
Also since its a build issue, if you can share how you are building the sketch (e.g. if by platformio the ini file) and i can quickly reproduce this
I am trying to build to run on the nrf52. I first tried using platformio and then the Arduino IDE to make sure there wasn't some difference. Let me upload what I have.
This is what is in platformio.ini:
[env:adafruit_feather_nrf52840] platform = nordicnrf52 board = adafruit_feather_nrf52840 framework = arduino lib_deps = cujomalainey/ANT@^2.0.1 cujomalainey/ANT+@^1.1.1
Here is my project:
But is it using the serial interface. I'll upload my best guess at using the native interface.
Thank you for looking at this. I'd really like to use your library to create a replacement sensor for my indoor cycle trainer.
This is my best attempt at building native. I think it is pretty naive. I also know I need to get the softdevice running. I'm nit sure how to do that. You can tell I don't know much yet.
Including HardwareSerial.h doesn't help. It looks like the nrf52 core does not define Serial for nrf52840, just Serial1. It does define both for nRF52832. I just changed everything to Serial1. I also added the soft device headers as a plarformio lib to my project and made some include changes to pull in the right includes. I am now down to just these errors:
.pio/build/adafruit_feather_nrf52840/libFrameworkArduino.a(Uart.cpp.o): In function serialEventRun()': Uart.cpp:(.text._Z14serialEventRunv+0x8): undefined reference to
Adafruit_USBD_CDC::available()'
Uart.cpp:(.text._Z14serialEventRunv+0x2c): undefined reference to `Serial'
collect2: error: ld returned 1 exit status
*** [.pio/build/adafruit_feather_nrf52840/firmware.elf] Error 1
These seem to problems with the nRF52 core for nRF52840. Uart.cpp is in the nRF52 core. I changed Serial to Serial1 in Uart.cpp in the code in ~/.platformio and it builds. I'm not sure why the undefined reference to `Adafruit_USBD_CDC::available()' went away.
This is my latest project: arduino-ant-test-native.tar.gz
Do you have instructions for getting the soft device running on this board? Is that part of the boot loader? Sorry, I really don't know a lot about ANT.
Are these good instructions for building the boot loader with the soft device and installing it on the board?
https://blogarak.wordpress.com/2020/03/15/s340-softdevice-adafruit-nrf52840-express-feather/
Sorry if I'm asking outside of the scope of this project, but I think it would be great to make this work. I would be very happy to contribute back samples and documentation.
Yep, those are good for the S340 example, but they are definitely a bit much for a simple reference bug :) , but I figured out this issue, it looks like its a bug in Adafruits bsp package. You need to include #include <bluefruit.h>
at the top of your sketch in order to get the reference to the Serial
object.
see https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather/custom-hrm
Let me know if that helps. Thanks
closing as there has been no response for a few days, feel free to open if it did not resolve the problem
I've installed the board libraries for the Adafruit Feather nRF52840 Express and ANT-Arduino and ANTPLU-Arduino. I get errors trying to build the HeartRateMonitor example. The code uses ArduinoSerialAntWithCallbacks, but I believe I should use ArduinoNativeAntWithCallbacks with this board. Is that correct? Are there instructions on how to build native ANT code for this board?
These are the errors: /home/jludwig/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: sketch/HeartRateMonitor.ino.cpp.o: in function
defaultDataPageHandler(HeartRateDefaultMsg&, unsigned int)': /home/jludwig/Arduino/libraries/ANTPLUS-Arduino/examples/HeartRateMonitor/HeartRateMonitor.ino:100: undefined reference to
Serial' /home/jludwig/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: sketch/HeartRateMonitor.ino.cpp.o: in functionmanufacturerInformationDataPageHandler(HeartRateManufacturerInformationMsg&, unsigned int)': /home/jludwig/Arduino/libraries/ANTPLUS-Arduino/examples/HeartRateMonitor/HeartRateMonitor.ino:107: undefined reference to
Serial' /home/jludwig/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: sketch/HeartRateMonitor.ino.cpp.o: in functionproductInformationDataPageHandler(HeartRateProductInformationMsg&, unsigned int)': /home/jludwig/Arduino/libraries/ANTPLUS-Arduino/examples/HeartRateMonitor/HeartRateMonitor.ino:121: undefined reference to
Serial' /home/jludwig/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: sketch/HeartRateMonitor.ino.cpp.o: in functionsetup': /home/jludwig/Arduino/libraries/ANTPLUS-Arduino/examples/HeartRateMonitor/HeartRateMonitor.ino:47: undefined reference to
Adafruit_USBD_CDC::begin(unsigned long)' /home/jludwig/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /home/jludwig/Arduino/libraries/ANTPLUS-Arduino/examples/HeartRateMonitor/HeartRateMonitor.ino:64: undefined reference toSerial' /home/jludwig/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: libraries/ANT-Arduino/MainClasses/ANT_ArduinoSerialAnt.cpp.o: in function
ArduinoSerialAnt::ArduinoSerialAnt()': /home/jludwig/Arduino/libraries/ANT-Arduino/src/MainClasses/ANT_ArduinoSerialAnt.cpp:13: undefined reference toSerial' /home/jludwig/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: ../arduino_cache_635859/core/core_adafruit_nrf52_feather52840_softdevice_s140v6,debug_l0_e7698368969bfe2927a612dac99d781a.a(Uart.cpp.o): in function
serialEventRun()': /home/jludwig/.arduino15/packages/adafruit/hardware/nrf52/1.1.0/cores/nRF5/Uart.cpp:27: undefined reference toAdafruit_USBD_CDC::available()' /home/jludwig/.arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /home/jludwig/.arduino15/packages/adafruit/hardware/nrf52/1.1.0/cores/nRF5/Uart.cpp:27: undefined reference to
Serial' collect2: error: ld returned 1 exit status exit status 1 Error compiling for board Adafruit Feather nRF52840 Express.