Adafruit is open and shipping! Let's build back better, together!
0

Adafruit Feather nRF52840 - Quadrature decoder
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Adafruit Feather nRF52840 - Quadrature decoder

by MKCreatin1 on Mon Nov 16, 2020 9:41 am

Hello,
Is it possible, using Arduino IDE, to access the nrf52480's quadrature decoder module when using the Adafruit Feather nRF52840?

I'm interested in speed feedback, using the nrf52840s hardware, from a motors quadrature encoder.

Many thanks,
Matt

MKCreatin1
 
Posts: 4
Joined: Tue Aug 25, 2020 7:09 am

Re: Adafruit Feather nRF52840 - Quadrature decoder

by dastels on Mon Nov 16, 2020 12:09 pm

Short answer: yes, you're working in C++ and can do anything supported by the hardware.

Longer answer: Some research is warranted and as a last resort you could find the relevant material in section 6.18 of the nRF52840 tech manual https://infocenter.nordicsemi.com/pdf/nRF52840_PS_v1.1.pdf. It looks like there is some work done that would at least be a place to start: https://github.com/adafruit/Adafruit_nRF52_Arduino/tree/master/libraries/RotaryEncoder

dastels
 
Posts: 4135
Joined: Tue Oct 20, 2015 3:22 pm

Re: Adafruit Feather nRF52840 - Quadrature decoder

by MKCreatin1 on Sat Nov 21, 2020 5:40 pm

Thanks dastels! I've begun looking down this rabbit hole.

One question that I'm stuck on at the moment is that I can't seem to compile a program that references a nrf52840 register. I have picked a random register within the qdec called "IRK".

Can anyone tell me why it won't compile?

Thanks for your time!


Code: Select all | TOGGLE FULL SIZE
#include <Arduino.h>
#include <bluefruit.h>

void setup() {
IRK |= B00100000;
}
void loop() {
}

MKCreatin1
 
Posts: 4
Joined: Tue Aug 25, 2020 7:09 am

Re: Adafruit Feather nRF52840 - Quadrature decoder

by dastels on Sat Nov 21, 2020 6:36 pm

You'll need a header for the MCU, i.e. the nRF52840. Hmm.. maybe start digging in the Arduino hardware support. On my machine that's at ~/.arduino15/packages/adafruit/hardware/nrf52/

Or maybe the rotario support in CircuitPython: https://github.com/adafruit/circuitpython/tree/main/ports/nrf/common-hal/rotaryio.

Dave

dastels
 
Posts: 4135
Joined: Tue Oct 20, 2015 3:22 pm

Please be positive and constructive with your questions and comments.