Comments: nRF52832 Breakout Board Hookup Guide

Pages

Comments 46 comments

  • ——————– Tech Support Tips/Troubleshooting/Common Issues ——————–

    Button Timing to Put nRF52832 in Bootloader Mode

    The timing of the RESET and “06” buttons is tricky to get the nRF52832 to enter its bootloader. One suggestion is holding down “06” button and plugging it into the FTDI so you do not have to simultaneously press down on both buttons. This can take a few tries but it is another alternative to get the board into its bootloader.

    Doing a quick test, the nRF52832 should stay in bootloader mode for about 2 minutes as long as there is power to the nRF52832.

    I2C w/ nRF52832

    If you are trying to use an I2C sensor with the nRF52832, you should be able to redefine the default pin definition for the nRF52832 to any other pin that is not currently being used. For example, I wanted to connect the TMP102 sensor to the nRF52832. It was working on an Arduino Uno w/ Atmega328P with the I2C pins [ http://bildr.org/2011/01/tmp102-arduino/ ]. The default I2C pins on the nRF52832 are currently defined on pins 20 and 21 [ https://github.com/sparkfun/Arduino_Boards/blob/nrf5/sparkfun/nrf5/variants/SparkFun_nRF52832_Breakout/variant.h#L105 ].

    1.) Looking at the nRF52832’s schematic [ https://cdn.sparkfun.com/assets/learn_tutorials/5/4/9/sparkfun-nrf52832-breakout-schematic-v10.pdf ], it indicates that pin 24 and 25 were free so I decides to use the pins.

    2.) Since I had the nRF52832 board add on, I had to go to my installed board definitions. You will need to going to File>Preferences .

    3.) Click on the additional preferences by clicking on the directory C:\Users…\AppData\Local\Arduino15 . The “…” will probably be your user name.

    4.) You will need to go to the nRF52832’s variants.h file. It will probably look like this: C:\Users...\AppData\Local\Arduino15\packages\SparkFun\hardware\nRF5\0.2.3\variants\SparkFun_nRF52832_Breakout . I initially navigated to the file by browsing the folders like so:

    4a.) Click on the packages folder.

    4b.) Click on the SparkFun folder.

    4c.) Click on the hardware folder.

    4d.) Click on the nRF folder

    4e.) Click on the current board version installed. This will probably be the folder named 0.2.3 .

    4f.) Click on the variants folder.

    4g.) Click on the SparkFun_nRF52832_Breakout folder.

    5.) Open the “variant.h” file with a text editor. I usually use ConText editor.

    6.) After opening the file, I modified lines 105 and 106 by changing:

    #define PIN_WIRE_SDA    (20u)
    #define PIN_WIRE_SCL    (21u)
    

    to a pin that was available:

    #define PIN_WIRE_SDA    (24)
    #define PIN_WIRE_SCL    (25)
    

    Note: The schematic for the nRF52832’s referenced the pins with 3 different designations (the QFN48 pin assignment name, pin location, and the trace name ). This can be confusing when you want to define the pins for Arduino. So I looked at how the other pins were defined for reference. I noticed that the analog pin defined in software for A4 was defined on line 60 as pin “28” instead of the trace name"P28". Therefore, I defined PIN_WIRE_SDA as “24” and PIN_WIRE_SCL as “25 instead of "P24” and “P25”. I decided not to use pin 21 since it was already being used for RESET and it was not broken out on the sides. I also could not get this working on the analog pins A4 and A5. It might be due to the defined pins being used already for analog inputs or the hardware not being able to support two functions on the nRF52832.

    7.) Save the changes.

    8.) Close out all instance of the Arduino IDE.

    9.) Connect the I2C sensor to the nRF52832. The TMP102 sensor’s minimum connection just required power and the I2C bus:

    TMP102 <=> nRF52832
     VCC   <=>   3.3
     GND   <=>   GND
     SDA   <=>   24
     SCL   <=>   25
    

    Note: Make sure that you check your I2C device’s requirements to safely connect the it to the nRF52832. The connection might be different depending on the hardware design of the I2C device. Certain I2C sensors might require additional pin connections to function!

    10.) Copy the example code that you are using and use it in Arduino IDE v1.6.11 or higher. I used the bilder sketch that was linked for the TMP102.

    11.) Put the nRF52832 in bootloader mode as explained in the tutorial.

    12.) Hit the “upload” button.

    13.) After uploading, press the reset button to go into the sketch’s application code.

    By following the directions listed above, I was able to view the TMP102’s sensor data in the Arduino serial monitor just like it was on the Arduino Uno’s Atmega328P.

    Compatibility Issues w/ Arduino IDE Version

    It would be better to use Arduino IDE v1.6.11+ . I usually suggest using Arduino v.1.6.5. However, there were issues using v.1.6.5 to upload to the nRF52832 due to the core files. I was able to upload using Arduino v1.6.11. You might see this error if you are using an Arduino IDE version below v1.6.11:

    Arduino: 1.6.5 (Windows 7), Board: "SparkFun nRF52832 Breakout, S132, Crystal Oscillator"
    
    arm-none-eabi-gcc: error: C:\Users\...\AppData\Local\Temp\build8214718593324383590.tmp/core.a: No such file or directory
    Error compiling.
    

    Another tech support representative had issues with v1.6.8 but he was able to upload using Arduino v.1.6.12. As an example, you might see this error if you are using a Mac iOS X and v1.6.8:

    In file included from /Users/techsupport/Library/Arduino15/packages/SparkFun/hardware/nRF5/0.2.3/cores/nRF5/Arduino.h:53:0,
    from /var/folders/6d/q6qbfw2112d0n64rqyd76qk00000gp/T/buildb09623f3ae75da8795d00d5245bade27.tmp/sketch/Blink.ino.cpp:1:
    /Users/techsupport/Library/Arduino15/packages/SparkFun/hardware/nRF5/0.2.3/cores/nRF5/delay.h:28:23: fatal error: nrf_delay.h: No such file or directory compilation terminated.
    exit status 1
    Error compiling for board SparkFun nRF52832 Breakout.
    

    Compatibility Issues w/ Mac iOS X Version

    There is a compatibility issue with the nRF52832 board definitions and older versions of the Mac iOS X. You’ll probably see an Arduino error similar to the outputs shown below when you are trying to compile and upload. Here are some errors that appeared when I was testing the board on our old Mac iOS X Lion v10.7.5:

    1.) Arduino v1.6.11 error:

    Error loading Python lib '/var/folders/6d/q6qbfw2112d0n64rqyd76qk00000gp/T/_MEIUYX37f/Python': dlopen(/var/folders/6d/q6qbfw2112d0n64rqyd76qk00000gp/T/_MEIUYX37f/Python, 10): Symbol not found: ___sincos_stret
    Referenced from: /var/folders/6d/q6qbfw2112d0n64rqyd76qk00000gp/T/_MEIUYX37f/Python
    Expected in: /usr/lib/libSystem.B.dylib in /var/folders/6d/q6qbfw2112d0n64rqyd76qk00000gp/T/_MEIUYX37f/Python
    exit status 255
    Error compiling for board SparkFun nRF52832 Breakout.
    

    2.) Arduino v1.8.1 error:

    Error loading Python lib '/var/folders/6d/q6qbfw2112d0n64rqyd76qk00000gp/T/_MEIijUukz/Python': dlopen(/var/folders/6d/q6qbfw2112d0n64rqyd76qk00000gp/T/_MEIijUukz/Python, 10): Symbol not found: ___sincos_stret
    Referenced from: /var/folders/6d/q6qbfw2112d0n64rqyd76qk00000gp/T/_MEIijUukz/Python
    Expected in: /usr/lib/libSystem.B.dylib  in /var/folders/6d/q6qbfw2112d0n64rqyd76qk00000gp/T/_MEIijUukz/Python
    exit status 255
    Error compiling for board SparkFun nRF52832 Breakout.
    

    There was a customer that had a similar error output as seen above. The customer eventually got their SparkFun nRF52832 Breakout to work on their Mac OS X version by updating version Mac iOS X v10.10.5 to Mac iOS X Sierra v10.12 . As suspected, it was a compatibility issue with board add-ons and the OS version . It’s not the best option but try updating your Mac’s operating system to get the nRF52832 working on your Mac. Otherwise, try using the board on another OS.

    Pinout for the “nrf52832-dk”

    You should be able to find the pinouts for the “nrf52832-dk” in the documentation. However, doing a search online, this image shows a good pinout => http://www.semiconductorstore.com/images/Items/Nordic/nrf52_dk_002.jpg

    Nordic’s Guide to Using nRF52832 w/ Nordic SDK

    There are in the tutorials resources that eventually lead to Nordic’s guide to using the nRF52832 with the Nordic SDK. Try going to this link for more information about using the Nordic SDK => [ http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v12.0.0%2Fnrf51_getting_started.html&cp=4_0_0_1 ].

    • Thanks bboy, I was able to hookup an I2C device using your instructions on pins 16 and 17 of the nRF52832 Breakout.

      • Hi, how about reading from analog input (e.g., A4 or pin 28)?, it is does not display anything on Serial Monitor (not reading) using Arduino IDE analog read commands. Can I read analog input pins? any suggestions? thanks. const int analogPin = 28; // P28, 1st attempt failed //const int analogPin = A4; // 2nd attempt also failed void setup() { pinMode(analogPin, INPUT); Serial.begin(9600); } void loop() { int sensorValue = analogRead(analogPin)/4; Serial.println(sensorValue); delay(10); }

  • Hi guys,

    I bought one of your boards. I also have the NRF52 DK from Nordic. I programmed the breakout board via the DK over SWD. And I cut the power LED. My code is running on both (DK and Breakout) and they both get the same results, besides:

    The current consumption on my breakout board has a steady offset of about 400uA @2.8V / 145uA @ 1.8V. (I got a power analizer and I’m quite sure, that it is a constant current)

    On the DK, the current is about 4uA (and thats what I expect).

    So any idea, where this difference is coming from?

    Best regards Roger

    UPDATE: I solved the problem: Although I connected a power supply to 3V3 and not Vin, the on-board regulator caused the additional 400uA. I desoldered the regulator and now I’m getting my 4uA ;-)

    • Hi

      I have been trying most of the day to do what you are doing (DK and Breakout using SWD). I am able to build/deploy/debug directly on the DK. I am pretty sure I have the wires correct between the DK and Breakout. I have code that runs on the Breakout (or I think) but I can’t seem to get just the pin 7 (blue led) to flash to prove that it is working.. Any tips ?

      • Do you have any picture or schematic how you wired DK and breakout board? You need 4 wires to program (GND detect, SWDIO, SWDCLK, VTG) and another 2 wires to power it. All 6 wires are required. Once connected you can flash as you flash your DK, it will just be forwarded to the breakout board.

  • Are there any examples / guidelines of how to use the “proprietary 2.4 GHz protocol” from inside an Arduino sketch?

  • This nRF52832 Breakout Board seems to pre-programm with a serial bootloader inside it. If i buy a raw nRF52832 chip and design the circuit by myself, how can i pre-programm the serial bootloader in it? So i could use the FTDI Basic (or an FTDI Basic -like device) to burn my program inside it. Thanks for your help!

    • Even I have the same doubt. Did you get the answer. Please comment the answer here if you know how to pre program serial bootloader into nrf52832 IC

      • I bought the nrf52 development kit pca10040 board from nordic which has the jtag programmer built in to it with an external connectot. Using this, you can program the boot loader into this sparkfun board or any other NRF52 chip. You’ll need to add the 10 pin 1.27 mm pitch connector to sparkfun board and get a corresponding ribbon cable. There’s discussions on the Nordic site about this https://devzone.nordicsemi.com/question/80853/external-programming-using-nrf52-dk/. There’s also a way using a cheap programmer, https://pcbreflux.blogspot.com/2016/09/nrf52832-first-steps-with-st-link-v2.html. I haven’t tried this yet but plan on doing so in the future at some point.

  • This thing is pretty useless. Out of 100+ attempts to enter the bootloader via the already finicky method, only 1 succeeded. It’s going RMA.

  • I just got one of these boards, and when I first plugged it in, it was in DFU mode. I uploaded the blink sketch to it, which seemed to work successfully. However, no matter what I do now, I can’t get it back into DFU mode. I’ve tried every combination of pressing the two buttons I can think of, and nothing seems to work. Thanks for your help!

    • The timing is difficult. I suggest unplugging the FTDI to power down the nrf52, holding down the pin6 button, then plugging in the FTDI. This should get you into the boot loader every time.

    • in my case, there is no problem at all, very stable and enyoying it

    • I’m getting the same thing; we’ve got 6 boards here, 5 of which are flashed. Only the single unflashed board will go into bootloader 100% of the time and the others 0% of the time, using both the RESET method and plugging/unplugging the FTDI. The other 5 will stick with the user LED lit blue until we release the 06 button and after a few seconds will then proceed into the blink.

      One thing I did notice was in the last board we’d flashed, it was able to go back into bootloader mode as long as it was still connected to power after being flashed. I got into bootloader mode twice after flashing the blink sketch, and after unplugging it from the FTDI to test a previous board, it was not able to go back into the bootloader when reconnected.

      Did you ever have any luck?

  • Hello I can communicate with the nRF52832 breakout only if I use the app “nRF Connect” from the google play store. If I try to do a pairing from the Android bluetooth setting it tells me: “Pairing rejected by nRF52832”.

    Is there a way to make it works outside the “nRF Connect” ?

  • Hi, I have trying to solve how to soft reset and write into the device eeprom or flash memory but i could not find any reference. eeprom.h seems not to work on this board.

  • Hi all I bought this board and want to use the ant feature on it however i cant find any recources or schematics on how to transmit data using the ant protocol with this board

  • I’m considering buying one of these because of the form-factor, but … I’ve done a ton of development on the Nordic nRF52 DK kit, using mBed OS and I was wondering if I can use this same code on this board? I can’t use Arduino for this project – Arduino just isn’t up to the task and trust me, I’ve tried – so I’ll need to use mBed or some other RTOS. mBed preferred since I already have the code perfected there.

  • Has anyone had success reading the ADC pins on this breakout board?

    I have a potential divider (two 4k7 resistors) between 5V and GND - so approximately 2.5V at the ADC however every pin reports back with an ADC value of 4095 (at 12bit resolution).

    The analog reference is set as internal reference.

  • I’ve only recently bought one of these boards but I’m wondering, is the on-board 32MHz xtal used at all? Looking through the Ardunino backend, I can’t see where the external crystal is set up. The only think I can see crystal-related is the 32.768kHz LF clock which is set up in wiring.c. Can anyone shed any light? Thanks.

  • Hi, I have just received one of these boards and used the above hookup guide. I get compilation errors : Arduino: 1.8.5 (Linux), Board: “SparkFun nRF52832 Breakout, S132, Crystal Oscillator”

    Build options changed, rebuilding all /home/ian/.arduino15/packages/SparkFun/tools/gcc-arm-none-eabi/5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .heap by 4 bytes /home/ian/.arduino15/packages/SparkFun/tools/gcc-arm-none-eabi/5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .stack_dummy by 4 bytes /home/ian/.arduino15/packages/SparkFun/tools/gcc-arm-none-eabi/5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .heap by 4 bytes /home/ian/.arduino15/packages/SparkFun/tools/gcc-arm-none-eabi/5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .stack_dummy by 4 bytes /home/ian/.arduino15/packages/SparkFun/tools/gcc-arm-none-eabi/5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .heap by 4 bytes /home/ian/.arduino15/packages/SparkFun/tools/gcc-arm-none-eabi/5_2-2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/bin/ld: warning: changing start of section .stack_dummy by 4 bytes fork/exec /home/ian/.arduino15/packages/SparkFun/tools/nrfutil/0.5.2-SFE/dist/nrfutil: permission denied Error compiling for board SparkFun nRF52832 Breakout.

    As you can see, I am running Linux (Ubuntu 16.04). Any suggestions onhow to fix this?

  • Hi, I am keen to use the ant+ feature on this breakout board. I live in Australia and I can’t seem to purchase the nRF52832 Hardware Development Kit from Nordic. But I am able to purchase the NRF52840 dev kit instead, which is weird. Can I program this breakout board with the NRF52840 dev kit?

  • How to get NRF into bootloader mode: Press 06 button then reset button and hold both down for at least 5 seconds. Release the reset button while still holding the 06 button and wait until both LEDs flash (this may take up to about 15 seconds). The red LED should turn back on and the blue LED should start blinking. The board should now be in bootloader mode. This seems to be a fairly relaible way. I have unplugged it from the USB cable multiple times and have been able to do it again. If it seems like it was not working I would unplug and replugh and repeat the process, but it seemed like a rare occasion when I had to do that.

    • Also it seems that if you are powering it with a USB cable from your laptop, you will need to divide the voltage to below 3.3V, since the input pins cannot handle 5 volts, which is what the laptop will provide. This is probably what is making the chip hot.

  • Hello , I recently bought sparkfun’s nrf52832 breakout board. It comes with preprogrammed serial boot loader. How ever after flashing code from nrf52 DK into my nrf52832 sparkfun breakout board, serial bootloader has been erased. I would like to take my spark fun board to previous state. Please tell me how to program serial bootloader into it. Here is the link for sparkfun github repository. https://github.com/sparkfun/nRF52832_… This repo contains firmware folder. Is that useful to solve my purpose.Please help me in this regard.

    • bboyho / last year / 1

      Hi, we do not usually monitor the comments section. I just happened to notice this when updating a note. I do not know the specific details of how to reprogram the nRF52832 breakout board using the hardware development kit. However, you are on the right track. The .hex files with the bootloader are located in that GitHub Repository [ https://github.com/sparkfun/nRF52832_Breakout/tree/master/Firmware/bootloader-custom ]. Try checking the links and the notes in the README.md .=)

  • How can I put this board in bootloader mode? I tried to hold the 06 button and reset or disconnect and connect a basic FTDI, with external power or power from FTDI and no way to put it in bootloader mode (this only work in my first try, when I load a BLE LED blink tutorial) Please any help with this

  • Looking for the correct sequence for uploading when the Breakout is connected through Nordic’s NRF52 DK. I have the example Blink sketch uploaded using RESET and 06 buttons & Beefy. Then Beefy is disconnected, 3V3 supplied to Breakout and connected to NRF52 DK as per the image for faster programming. Error message: No data received on serial port. Is the RESET & 06 button for timebomb still necessary? (tried that and same error msg, no data). Or how is this done?

  • Thanks for suggestion to redefine SDA/SCL!

    On a different project, I’m trying to use Spark nRF52 as a UART device with default RX(26) and TX(27), but I cannot get it to send any data.

    MIDI_CREATE_INSTANCE(HardwareSerial, Serial, MIDI);

    Any suggestions?

  • Hi I’m trying to set the SAADC configuration to the internal reference and the gain to 1/6 to set the reference to 3.6V. I’ve used the following code in my setup function, but nothing changes:

        NRF_SAADC->CH[0].CONFIG = (SAADC_CH_CONFIG_GAIN_Gain1_6    << SAADC_CH_CONFIG_GAIN_Pos) |
                            (SAADC_CH_CONFIG_MODE_SE         << SAADC_CH_CONFIG_MODE_Pos) |
                            (SAADC_CH_CONFIG_REFSEL_Internal << SAADC_CH_CONFIG_REFSEL_Pos) |
                            (SAADC_CH_CONFIG_RESN_Bypass     << SAADC_CH_CONFIG_RESN_Pos) |
                            (SAADC_CH_CONFIG_RESP_Bypass     << SAADC_CH_CONFIG_RESP_Pos) |
                            (SAADC_CH_CONFIG_TACQ_20us       << SAADC_CH_CONFIG_TACQ_Pos);
    

    It would be great if someone gives me feedback on what to change and how to modify the SAADC configuration

    • I found that when you call the analogRead() function it resets the values of the CONFIG register. To solve this I had to wirte my own analogRead() function.

  • I have problems getting into the bootloader reliably. I tried the method from the guide, involving reset, and also unplugging the USB connection, then plugging it in with the button held. It almost never works, and I cannot find a reliable way to get the thing into programming mode. Does anyone know a reliable way?

  • Hello , I recently purchased NRF52832 breakout board. BLE is working. On powering the board, analog pins are staying at 0.77 volts by default. Board is powered at 3.3 volts. Is there any way proper way to use analog pins for this board?

  • Is it possible to write a HEX file to the breakout board with a USB FTDI programmer? For example, could I run pre-compiled examples from Nordic’s NRF5 SDK in this way? I’m starting to think that this is not possible due to the serial bootloader, and that I would need to use the Nordic DK board and program via JTAG.

  • Cannot use i2c on Spark nRF52832 Breakout

    Want to run the i2c_scanner sketch at https://playground.arduino.cc/Main/I2cScanner but the board seem to freeze every time. I am using Arduino IDE.

    Step 1. Modify the variant.h file as mentioned here, so that SDA=24 and SCL=25. I also tried other values, e.g., SDA 16 and SCL 17, but without good results. Step 2. Connect Spark nRF52832 Breakout to USB FTDI adapter TX->RX,RX->TX (3.3v levels) and GND->GND (no Vcc !) Step 3. Connect I2C device (e.g., OLED display or MPU6050 gyro sensor, or what have you) to Spark nRF52832 Breakout pins SDA->24, SCL->25, GND->GND (no Vcc !) Step 4. Supply external regulated 3.3V (and also a common GND) to Spark nRF52832 Breakout and to I2C device. Step 5. Connect USB FTDI to computer Step 6. Power everything up Step 7. Put Spark nRF52832 Breakout into programming mode using the two voodoo buttons and the associated ritual. Step 8. Upload the i2c_scanner sketch. I actually modified a little the sketch so that it prints to serial output the counter so that watch the scanning progress. Step 9. Press the Reset button on Spark nRF52832 Breakout and the go to Arduino IDE Serial Monitor with 9600 baud Step 10. Witness the counter freeze at 60 or at 106 (or whatever ID your I2C device has).

    Note: the I2C devices work fine with ARduino Uno, ARduino Pro Mini or whatever. It is the Spark nRF52832 Breakout that seems to be unable to freeze when doing i2c.

    The freeze seems to happen when calling Wire.endTransmission().

    Any ideas, please.

    Best regards Mihai

    • Well,

      Screw the i2c scanner.

      Looking at the samples bundled in nrf52 from github (https://github.com/sparkfun/nRF52832_Breakout), and I mean look in C:\Users.… your user name ….\AppData\Local\Arduino15\packages\SparkFun\hardware\nRF5\0.2.3\libraries\Wire\examples, I noticed that using i2c with nRF52832_Breakout is straightforward.

      No i2c scanning, just plug in the values and go ahead.

      So I went ahead and uploaded a sketch for an OLED i2c display, making sure to plug in the appropriate values for sda and scl pins in the constructor call. I.e., Step 1 - Make sure the variant.h file was updated as mentioned here in this forum. I chose pins 16 and 17 this time for no reason. Step 2 - Use the following constructor for u8g2 oled sample:

      U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, / clock=/ PIN_WIRE_SCL, / data=/ PIN_WIRE_SDA, / reset=/ U8X8_PIN_NONE);

      (PIN_WIRE_SCL and PIN_WIRE_SDA are defined in variant.h as mentioned before)

      Step 3. Profit !

      Note: I tested this with and without 4.7 KOhm pullups for pins 16 and 17. It makes no difference, works fine with and without the pullups.

      Cheers.

  • ST Link v2

    Has anybody tried to use the ST Link v2 programmer to code and debug their nRF52832. I have heard this is a fantastic tool for homebrew programming and debug for ARM devices, but I am having trouble getting the tool chain to work properly. The ST Link v2 should be able to connect from the Arduino IDE or the Eclipse OpenOCD setup.

  • I followed the board Hookup guide and after installing the libraries (i.e., nRF52 and SparkFun nRF52832 Breakout), it seems it’s working fine. However, when I attempted to read analog data from A4/28, it is does not display anything on Serial Monitor (not reading): Can I read analog input pins? any suggestions? thanks.

    const int analogPin = 28; // P28, 1st attempt failed
    //const int analogPin = A4; // 2nd attempt also failed 
    void setup() {
    pinMode(analogPin, INPUT);
    Serial.begin(9600);
     }
    void loop() {
    int sensorValue = analogRead(analogPin)/4;
    Serial.println(sensorValue);
     delay(10); }
    
  • exec: "C:\\Users\\Lenovo": file does not exist
    Error compiling for board nRF52 DK.
    

    I got the above error. I tried in 1.8.1 as well as 1.6.11 IDE. Help me

  • Hi a couple questions if I may: 1) I’m assuming I can rig my Arduino UNO to act as FTDI to the board per this instructable? http://www.instructables.com/id/Arduino-Examples-2-Use-an-Arduino-as-a-FTDI-Progr/

    2) Having followed the IDE set-up instructions above, I see SoftDevice S132 in the Tools menu. I’m after SoftDevice S210. Any guidance on configuring and programming this SoftDevice in the IDE?

  • Hello, I purchased one of these boards and I am having some serious problems programming it. The current sketch I have loaded just turns on the Blue LED. But when I am trying to boot the board so it is programmable sometimes it gets stuck in a mode where the LED is off and the board gets extremely hot (like painful to touch) within about 4-5s of getting stuck. Also, I have situations where the board will be in the proper mode to be programmed, I’ll hit upload on the IDE and the board will kick back into the LED off mode and do nothing and the programming will fail. Any ideas? I’m using a 3.3V FTDI cable.

  • I am trying to connect SparkFun nRF52832 Breakout and Adafruit 9-DOF IMU Breakout - L3GD20H + LSM303 together and run the example code giving in the sensor library called “accelsensor”. but nothing would show on the serial monitor.

    for the Sparkfun nRF board, I modified the “variant.h” so that the SCL and SDA pins are 25 and 23 following this discussion https://learn.sparkfun.com/tutorials/nrf52832-breakout-board-hookup-guide/discuss?_ga=1.189083752.299217124.1477067199#comment-58599a84f3b1a8770f8b4567

    Hardware connection: saprkfun board adafruit sensor 3.3V <===> VIN 25 <===> SCL 23 <====> SDA GND <====> GND

    To debug this I checked and made sure the baud rate is the same, which is 9600 in this case.

    The problem is, when I run the code, nothing gets print out on the serial port. Is it because I need to configure the I2C pins in the software after changing it in the library? if so, how would I configure the I2C pins?

    Following are the products: https://www.sparkfun.com/products/13990 https://www.adafruit.com/product/1714

  • Hey!! Can you tell me more about NFC Library Support and also Host Card Emulation or Type 4 Tag support.

  • NVMC Non-Volatile Memory Storage in Flash

    I’m trying to work out an example of storing values between resets in Flash. I seem to have succeeded, but have wiped out the boot loader. At the moment, my sketch is loaded, and it is reading the correct value from Flash, but I cannot get the Breakout board into boot loader mode. I assume this is because I have written over a critical page of memory in the boot loader code. So I’m left with 2 questions:

    1) How can I determine what a safe address is to write to? Some code uses CODEPAGESIZE times CODESIZE minus 1 to determine the last page of flash, and uses that. Using that method, I calculated an address of 0x7F000. But writing to that cause the board to go into bootloader mode on startup, even when pin6 was not pressed. So, following another example which had a hardcoded address, I rolled the dice and used 0x1000108C (EDIT: digging further, this is the address for a UICR register, which is not to be set during operation, whoops). This succeeded insofar as I was able to reboot the device into normal mode, and my sketch correctly read the value, however, as described above, the device no longer goes into bootloader mode. So, How to calculate a safe address space to use for storing values which doesn’t impact the bootloader or the sketch code? Perhaps some hints here

    2) Is my device bricked? I assume it would be possible to program with a JTAG to regain function, but seeing as I don’t have one, and don’t have the first clue on how to use one, am I out of luck?

    Code for writing to Flash, CAREFUL, it would appear this code can brick your device:

    void setup() {
      // put your setup code here, to run once:
      Serial.begin(38400);
    
      uint32_t pg_size = NRF_FICR->CODEPAGESIZE;
      uint32_t pg_num = NRF_FICR->CODESIZE - 1;
      Serial.print("Page Size: "); Serial.println(pg_size);
      Serial.print("Page Num: "); Serial.println(pg_num);
    
      uint32_t *calc_addr = (uint32_t *)(pg_size * pg_num);
      Serial.print("Suggested Address: ");
      Serial.println((uint32_t)calc_addr);
    
      uint32_t *addr = (uint32_t *)0x1000108C;
      Serial.print("Used Address: ");
      Serial.println((uint32_t)addr);
    
      Serial.print("Value before test: ");
      Serial.println(*addr);
    
      // Change the false on the next line to true to enable writing
      // Be extremely CAREFUL, this code may brick your device. DO NOT USE
      if(*addr != 1234 && false){
        Serial.print("Value before erase: ");
        Serial.println(*addr);
        flash_page_erase(addr);
        Serial.print("Value after erase: ");
        Serial.println(*addr);
        flash_word_write(addr,1234);
        Serial.print("Value after write: ");
        Serial.println(*addr);
      }else{
        Serial.print("Retrieved: ");
        Serial.println(*addr);
      }
    
    
    }
    
    void flash_word_write(uint32_t *addr, uint32_t value){
      NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos);
      while (NRF_NVMC->READY == NVMC_READY_READY_Busy){};
      *addr = value;
      while (NRF_NVMC->READY == NVMC_READY_READY_Busy){};
      NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos);
      while (NRF_NVMC->READY == NVMC_READY_READY_Busy){};
    }
    
    void flash_page_erase(uint32_t *addr){
      NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Een << NVMC_CONFIG_WEN_Pos);
      while (NRF_NVMC->READY == NVMC_READY_READY_Busy){};
      NRF_NVMC->ERASEPAGE = (uint32_t)addr;
      while (NRF_NVMC->READY == NVMC_READY_READY_Busy){};
      NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos);
      while (NRF_NVMC->READY == NVMC_READY_READY_Busy){};
    }
    
    void loop() {
      // put your main code here, to run repeatedly:
    
    }
    

If you've found a bug or have other constructive feedback for our tutorial authors, please send us your feedback!