This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Setting external GPIO interrupt with the USB dongle

Hi,

I'm very new to c programming and your hardware. Please excuse my novice questions.

I'm making a rotary braille display using nRF52840 dongle (PCA10059) as it's brain. The dongle will take interrupt input from phototransistors to trigger braille dot outputs according to values at index position on an array of braille code in the memory.

My previous prototype is Raspberry Pi-based and runs on Python as in this video

.

I see nRF52840 Dongle can greatly reduce the size of the braille display prototype.

Now I cannot get any external pin other than the on board ones to receive or output some voltage. What am I doing wrong?

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdbool.h>
#include <stdint.h>
#include "nrf_delay.h"
#include "boards.h"
#include "pca10059.h"
#include "app_timer.h"
#include "app_button.h"
#include "nrf_sdh.h"
// Rotation sensor inputs
// Encoder trigger
#define ENC_IN NRF_GPIO_PIN_MAP(0,10)
#define ENC_DIR NRF_GPIO_PIN_DIR_INPUT
#define ENC_PULL NRF_GPIO_PIN_PULLUP
// Direction detect
#define DIR_IN NRF_GPIO_PIN_MAP(0,13)
#define DIR_DIR NRF_GPIO_PIN_DIR_INPUT
#define DIR_PULL NRF_GPIO_PIN_PULLUP
// Buttons input
//#define BMIDA_IN NRF_GPIO_PIN_MAP(0,24)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Thank you,

Song

Parents Reply Children
  • Thank you Marjeris,

    I put it in main() and then I could measure some changing voltages.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    #include <stdbool.h>
    #include <stdint.h>
    #include "nrf_delay.h"
    #include "boards.h"
    #include "pca10059.h"
    #include "app_timer.h"
    #include "app_button.h"
    #include "nrf_sdh.h"
    // Rotation sensor inputs
    // Encoder trigger
    #define ENC_IN NRF_GPIO_PIN_MAP(0,10)
    #define ENC_PULL NRF_GPIO_PIN_PULLUP
    // Direction detect
    #define DIR_IN NRF_GPIO_PIN_MAP(0,13)
    #define DIR_PULL NRF_GPIO_PIN_PULLUP
    // Buttons input
    //#define BMIDA_IN NRF_GPIO_PIN_MAP(0,24)
    //#define BMIDA_DIR NRF_GPIO_PIN_DIR_INPUT
    //#define BMIDA_PULL NRF_GPIO_PIN_PULLUP
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Yours,

    Song

  • Some more questions.

    I used the wrong encoder input port in the first question they should be 1.10 and 1.13, not 0.10 and 0.13.

    Now even after I corrected the port and enabled pull-up to test pin-to-ground switch, input voltage is always 0. What is wrong now?

    The encoder input from phototransistor is measured between 1.9 to 2.1 V when no-block and blocked respectively. How can I set the pin to detect voltage change event? Which example should I look at?

    Thank you,