It's Holiday Sale Weekend at Adafruit - use the code ADATY to get 15% off items storewide! Some restrictions apply.
0

Feather nRF52832 can't upload program
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Feather nRF52832 can't upload program

by marcdavidson on Sun Sep 12, 2021 10:29 am

The error that I'm getting on 2 different nRF52832 Feathers

- Baud rate must be 115200, Flow control must be off.
- Target is not in DFU mode. Ground DFU pin and RESET and release both to enter DFU mode.

I'm using Arduino 1.8.16 on a MacBookAir running OS 11.5.2. I'm using a USB C adaptor. I have Adafruit's nRF52 board 1.0.0 in the Arduino board manager. I have successfully installed the available bootloader with the following displayed:

Upgrading target on /dev/cu.SLAB_USBtoUART with DFU package /Users/marc/Library/Arduino15/packages/adafruit/hardware/nrf52/1.0.0/bootloader/feather_nrf52832/feather_nrf52832_bootloader-0.6.1_s132_6.1.1.zip. Flow control is disabled, Dual bank, Touch 1200
Touched serial port /dev/cu.SLAB_USBtoUART
Opened serial port /dev/cu.SLAB_USBtoUART
...

Any ideas what I'm doing wrong? No mention in the user guide about having to ground and release these 2 pins.
Thanks

marcdavidson
 
Posts: 10
Joined: Sun Jan 08, 2017 9:02 am

Re: Feather nRF52832 can't upload program

by adafruit_support_mike on Sun Sep 12, 2021 7:46 pm

Try updating the bootloader as shown here:

https://learn.adafruit.com/bluefruit-nr ... bootloader

adafruit_support_mike
 
Posts: 63767
Joined: Thu Feb 11, 2010 2:51 pm

Re: Feather nRF52832 can't upload program

by marcdavidson on Mon Sep 13, 2021 9:32 am

I ended up uploading the bootloader using a Windows 10 computer and everything works fine on that machine. Subsequently I tried uploading a file using my MacBook (specifically the example file Adafruit Bluefruit nRF52 Libraries > Peripheral > bleuart. It says the the device is programmed

Sketch uses 75056 bytes (25%) of program storage space. Maximum is 290816 bytes.
Global variables use 9216 bytes (17%) of dynamic memory, leaving 43008 bytes for local variables. Maximum is 52224 bytes.
Upgrading target on /dev/cu.SLAB_USBtoUART with DFU package /private/var/folders/xp/67xdnchj0jjbbj3wv8wdctqc0000gn/T/arduino_build_608200/bleuart.ino.zip. Flow control is disabled, Single bank, Touch disabled
########################################
########################################
########################################
###########################
Activating new firmware
Device programmed.

Yet the program does not execute

It executes as expected when I do the same thing on my PC

marcdavidson
 
Posts: 10
Joined: Sun Jan 08, 2017 9:02 am

Re: Feather nRF52832 can't upload program

by adafruit_support_mike on Tue Sep 14, 2021 5:57 pm

Poat the code you're using between CODE tags please.

adafruit_support_mike
 
Posts: 63767
Joined: Thu Feb 11, 2010 2:51 pm

Re: Feather nRF52832 can't upload program

by marcdavidson on Wed Sep 15, 2021 1:44 pm

Adafruit Bluefruit nRF52 Libraries > Peripheral > bleuart

This program runs fine when I flash it on my Windows laptop but won't upload with my MacBook returning the error posted above

Code: Select all | TOGGLE FULL SIZE
/*********************************************************************
 This is an example for our nRF52 based Bluefruit LE modules

 Pick one up today in the adafruit shop!

 Adafruit invests time and resources providing this open source code,
 please support Adafruit and open-source hardware by purchasing
 products from Adafruit!

 MIT license, check LICENSE for more information
 All text above, and the splash screen below must be included in
 any redistribution
*********************************************************************/
#include <bluefruit.h>
#include <Adafruit_LittleFS.h>
#include <InternalFileSystem.h>

// BLE Service
BLEDfu  bledfu;  // OTA DFU service
BLEDis  bledis;  // device information
BLEUart bleuart; // uart over ble
BLEBas  blebas;  // battery

void setup()
{
  Serial.begin(115200);

#if CFG_DEBUG
  // Blocking wait for connection when debug mode is enabled via IDE
  while ( !Serial ) yield();
#endif
 
  Serial.println("Bluefruit52 BLEUART Example");
  Serial.println("---------------------------\n");

  // Setup the BLE LED to be enabled on CONNECT
  // Note: This is actually the default behavior, but provided
  // here in case you want to control this LED manually via PIN 19
  Bluefruit.autoConnLed(true);

  // Config the peripheral connection with maximum bandwidth
  // more SRAM required by SoftDevice
  // Note: All config***() function must be called before begin()
  Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);

  Bluefruit.begin();
  Bluefruit.setTxPower(4);    // Check bluefruit.h for supported values
  //Bluefruit.setName(getMcuUniqueID()); // useful testing with multiple central connections
  Bluefruit.Periph.setConnectCallback(connect_callback);
  Bluefruit.Periph.setDisconnectCallback(disconnect_callback);

  // To be consistent OTA DFU should be added first if it exists
  bledfu.begin();

  // Configure and Start Device Information Service
  bledis.setManufacturer("Adafruit Industries");
  bledis.setModel("Bluefruit Feather52");
  bledis.begin();

  // Configure and Start BLE Uart Service
  bleuart.begin();

  // Start BLE Battery Service
  blebas.begin();
  blebas.write(100);

  // Set up and start advertising
  startAdv();

  Serial.println("Please use Adafruit's Bluefruit LE app to connect in UART mode");
  Serial.println("Once connected, enter character(s) that you wish to send");
}

void startAdv(void)
{
  // Advertising packet
  Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
  Bluefruit.Advertising.addTxPower();

  // Include bleuart 128-bit uuid
  Bluefruit.Advertising.addService(bleuart);

  // Secondary Scan Response packet (optional)
  // Since there is no room for 'Name' in Advertising packet
  Bluefruit.ScanResponse.addName();
 
  /* Start Advertising
   * - Enable auto advertising if disconnected
   * - Interval:  fast mode = 20 ms, slow mode = 152.5 ms
   * - Timeout for fast mode is 30 seconds
   * - Start(timeout) with timeout = 0 will advertise forever (until connected)
   *
   * For recommended advertising interval
   * https://developer.apple.com/library/content/qa/qa1931/_index.html   
   */
  Bluefruit.Advertising.restartOnDisconnect(true);
  Bluefruit.Advertising.setInterval(32, 244);    // in unit of 0.625 ms
  Bluefruit.Advertising.setFastTimeout(30);      // number of seconds in fast mode
  Bluefruit.Advertising.start(0);                // 0 = Don't stop advertising after n seconds 
}

void loop()
{
  // Forward data from HW Serial to BLEUART
  while (Serial.available())
  {
    // Delay to wait for enough input, since we have a limited transmission buffer
    delay(2);

    uint8_t buf[64];
    int count = Serial.readBytes(buf, sizeof(buf));
    bleuart.write( buf, count );
  }

  // Forward from BLEUART to HW Serial
  while ( bleuart.available() )
  {
    uint8_t ch;
    ch = (uint8_t) bleuart.read();
    Serial.write(ch);
  }
}

// callback invoked when central connects
void connect_callback(uint16_t conn_handle)
{
  // Get the reference to current connection
  BLEConnection* connection = Bluefruit.Connection(conn_handle);

  char central_name[32] = { 0 };
  connection->getPeerName(central_name, sizeof(central_name));

  Serial.print("Connected to ");
  Serial.println(central_name);
}

/**
 * Callback invoked when a connection is dropped
 * @param conn_handle connection where this event happens
 * @param reason is a BLE_HCI_STATUS_CODE which can be found in ble_hci.h
 */
void disconnect_callback(uint16_t conn_handle, uint8_t reason)
{
  (void) conn_handle;
  (void) reason;

  Serial.println();
  Serial.print("Disconnected, reason = 0x"); Serial.println(reason, HEX);
}

marcdavidson
 
Posts: 10
Joined: Sun Jan 08, 2017 9:02 am

Re: Feather nRF52832 can't upload program

by Gatze on Sun Oct 03, 2021 8:18 am

Have you tried to put the board manually in DFU mode ? And than try to upload ? Just put a wire in de DFU hole and hold against the shield of the usb connector or another ground point and push reset (be carefull not to shortcut). The red led next to the USB connector starts to fade.

But probably this is some kind of driver issue....

marcdavidson wrote:Any ideas what I'm doing wrong? No mention in the user guide about having to ground and release these 2 pins.
Thanks

Some info over forcing the bootloader to start via the hardware:
https://learn.adafruit.com/bluefruit-nrf52-feather-learning-guide/using-the-bootloader

Gatze
 
Posts: 12
Joined: Tue Sep 28, 2021 2:59 am

Please be positive and constructive with your questions and comments.