Skip to content

Nano 33 BLE - enable the SPI1 sensors #67

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

Merged
merged 2 commits into from
Mar 6, 2025

Conversation

KurtE
Copy link

@KurtE KurtE commented Feb 5, 2025

Resolves: #51

There is an IO pin on the NANO that that when turned on, enables most of the sensors on the BLE sense which are on SPI1. The MBED version, enables this pin as part of the main().

Which I am trying to emulate. There is code already in, that if you use at least one of the zephyr device drivers, will eanble this pin. However that does not help when you are using external libraries or the like.

So I added details about this pin in our overlay file, in the zephyr,user section.

I then added code to main.cpp, that is only included if your are building using an NRFX board. Currently the nano and one of the nicla boards. Could also specically only do this on the NANO, but probably does not matter as, the code tries to find that property and only if it is found, does it turn on the pin.

Note: The MBED version turn on this pin with high drive. Which I emulated using the information, mentioned in the zephyr discussion.
zephyrproject-rtos/zephyr#78710 In one of my sketches I verified that the pin pads configuration looks the same as mbed setup.

With these changes I am able to access most of the sensors. Most of the testing has been done by @mjs513, with some by myself as well.

Copy link
Member

@facchinm facchinm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to move this in initVariant() inside the Nano 33 BLE variant.cpp, WDYT?

@facchinm
Copy link
Member

facchinm commented Mar 5, 2025

I would prefer to move this in initVariant() inside the Nano 33 BLE variant.cpp, WDYT?

To allow this I'm going to add a weak initVariant() in main.cpp as it already happens with all the other cores

@KurtE
Copy link
Author

KurtE commented Mar 5, 2025

Sounds good will try it out hopefully later today
Makes sense, to move out all of the core specific things into the variant.

Resolves: arduino#51

There is an IO pin on the NANO that that when turned on, enables most of the sensors on the BLE sense which are on SPI1.   The MBED version, enables this pin as part of the main().

Which I am trying to emulate.  There is code already in, that if you use at least one of the zephyr device drivers, will eanble this pin.  However that does not help when you are using external libraries or the like.

So I added details about this pin in our overlay file, in the zephyr,user section.

I then added code to main.cpp, that is only included if your are building using an NRFX board.  Currently the nano and one of the nicla boards.  Could also specically only do this on the NANO, but probably does not
matter as, the code tries to find that property and only if it is found, does it turn on the pin.

Note: The MBED version turn on this pin with high drive.  Which I emulated using the information,
mentioned in the zephyr discussion.
zephyrproject-rtos/zephyr#78710
In one of my sketches I verified that the pin pads configuration looks the same as mbed setup.

With these changes I am able to access most of the sensors.
Most of the testing has been done by @mjs513, with some by myself as well.
@KurtE KurtE force-pushed the nano_sense_spi1_enable_pin branch from 9282bc6 to aa0fca4 Compare March 5, 2025 18:32
Added call to main.cpp to initVariant.
Added a weak version in main.cpp.

Then moved the code for initializing the enable sensor pin out of main.cpp
into the initVariant that I added to variant.cpp for the specific board
@KurtE
Copy link
Author

KurtE commented Mar 5, 2025

I rebased this one and added the call to initVariant to main.cpp, added a week version in there as well that does nothing
And then moved the code into the Nano 33 sense variant.cpp file

@facchinm facchinm merged commit 7fdcd38 into arduino:arduino Mar 6, 2025
2 of 4 checks passed
@KurtE KurtE deleted the nano_sense_spi1_enable_pin branch March 6, 2025 16:38
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

Successfully merging this pull request may close these issues.

Nano 33 BLE Sense - Wire1 not fully initializing the hardware (Pull up and enable devices)
2 participants