jeraymond / pio-sparkfun_pro_nrf52840_mini-setup

Instructions for setting up PlatformIO for SparkFun Pro nRF52840 Mini development.
2 stars 3 forks source link

can't find usb.h #1

Open evanthomas opened 4 years ago

evanthomas commented 4 years ago

Thanks for this, I'm using this board too, and would love first class pio support.

After following the instructions if get:

/home/evan/.platformio/packages/framework-arduinoadafruitnrf52/variants/sparkfun_pro_nrf52840_mini/variant.cpp:26:10: 
fatal error: usb.h: No such file or directory

If I comment out the usb stuff it can't compile Adafruit_TinyUSB. I'm also using a adafruit nrf52840 board that the sparkfun board is based on. I found that with simply swapping out the variant.h and variant.cpp I could access the features on the SF board, not I really understand what is going on here.

evanthomas commented 4 years ago

I think the compile issues TinyUSB are because it is looking for PIN_SERIAL1_TX and PIN_SERIAL1_RX where are variant.h only provides PIN_SERIAL_TX and PIN_SERIAL_RX. If I change the definitions in variant.s it works.

In any case, I'm using a pre script as hack for my project. Hopefully, pio will come to the party soon.

Phando commented 4 years ago

@evanthomas Thank you for the tip. Did you run into any errors with USB_VID and USB_PID as well. Your fix got me one step closer, but now I am seeing errors for


... 'USB_VID' was not declared in this scope
... 'USB_PID' was not declared in this scope

Would you mind sharing your prescript?

Thanks!

evanthomas commented 4 years ago

I also had those errors and gave up on this library.

Unless you're working on both the adafruit and SF boards you can just copy the variant.* files to $HOME/.platformio/packages/framework-arduinoadafruitnrf52/variants/feather_nrf52840_express. I'm currently using both with the same code base so that's why I using the prescript.

My platformio.ini looks like:

;PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:adafruit_feather_nrf52840]
platform = nordicnrf52
board = adafruit_feather_nrf52840
framework = arduino
extra_scripts = pre:sf.py
lib_deps = 
    DHT sensor library@^1.3.8
    Adafruit Unified Sensor@^1.0.3
    SparkFun SCD30 Arduino Library@^1.0.6

I manually change the extra_scripts to pre:sf.py or pre:af.py depending on which board I am building for. The sf.py looks like:

import os
cmd = 'cp variants/sparkfun/variant.* $HOME/.platformio/packages/framework-arduinoadafruitnrf52/variants/feather_nrf52840_express'
os.system(cmd)

and af.py

import os
cmd = 'cp variants/adafruit/variant.* $HOME/.platformio/packages/framework-arduinoadafruitnrf52/variants/feather_nrf52840_express'
os.system(cmd)

It's awful. :\