Due to high demand expect some shipping delays at this time, orders may not ship for 1-2 business days.
0

Arduino on CLUE black screen
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Arduino on CLUE black screen

by tlpada on Mon Apr 27, 2020 12:34 am

Any code I compile and upload from the Arduino IDE to CLUE results in a black screen. This is true of the simplest code examples like "Blink", but also any of the Arduino 'Built-in Examples' or 'Examples for Adafruit Feather nRF52840 Express'-->Bluefruit nRF52 BLE stuff (which is what I'm ultimately trying to get working).

When the upload is successful, I get this on the Arduino console (in the case of 'Blink'):

Code: Select all | TOGGLE FULL SIZE
Sketch uses 35964 bytes (4%) of program storage space. Maximum is 815104 bytes.
Global variables use 6612 bytes (2%) of dynamic memory, leaving 230956 bytes for local variables. Maximum is 237568 bytes.
Upgrading target on /dev/ttyACM0 with DFU package /tmp/arduino_build_319615/Blink.ino.zip. Flow control is disabled, Single bank, Touch disabled
########################################
################################
Activating new firmware
Device programmed.
But then, black screen, whether or not , or toggle the reset button on the CLUE, or double-click the CLUE reset to completely restart the bootloader and upload the code. I also tried it on 2 different CLUE boards.

Loading pre-compiled UF2 Arduino code directly -- such as UF2 CLUE_TEST.UF2 and CLUE_gifplayer.UF2 -- work fine.

Running Arduino 1.8.12 IDE, running on Linux, with adafruit-nrfutil

I've tried changing the basic example code slightly just to recompile and re-upload to see if it makes any difference, it doesn't seem to (same black screen), when it uploads. More often it results in this error, not sure if it's related, but I'm also getting this constantly:

Code: Select all | TOGGLE FULL SIZE
Failed to upgrade target. Error is: Serial port could not be opened on /dev/ttyACM0. Reason: [Errno 16] could not open port /dev/ttyACM0: [Errno 16] Device or resource busy: '/dev/ttyACM0'
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/serial/serialposix.py", line 265, in open
    self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
OSError: [Errno 16] Device or resource busy: '/dev/ttyACM0'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tlp/.local/lib/python3.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 113, in open
    self.serial_port = Serial(port=self.com_port, baudrate=self.baud_rate, rtscts=self.flow_control, timeout=self.timeout)
  File "/usr/lib/python3.7/site-packages/serial/serialutil.py", line 240, in __init__
    self.open()
  File "/usr/lib/python3.7/site-packages/serial/serialposix.py", line 268, in open
    raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 16] could not open port /dev/ttyACM0: [Errno 16] Device or resource busy: '/dev/ttyACM0'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tlp/.local/lib/python3.7/site-packages/nordicsemi/__main__.py", line 294, in serial
    dfu.dfu_send_images()
  File "/home/tlp/.local/lib/python3.7/site-packages/nordicsemi/dfu/dfu.py", line 235, in dfu_send_images
    self._dfu_send_image(HexType.APPLICATION, self.manifest.application)
  File "/home/tlp/.local/lib/python3.7/site-packages/nordicsemi/dfu/dfu.py", line 157, in _dfu_send_image
    self.dfu_transport.open()
  File "/home/tlp/.local/lib/python3.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 115, in open
    raise NordicSemiException("Serial port could not be opened on {0}. Reason: {1}".format(self.com_port, e))
nordicsemi.exceptions.NordicSemiException: Serial port could not be opened on /dev/ttyACM0. Reason: [Errno 16] could not open port /dev/ttyACM0: [Errno 16] Device or resource busy: '/dev/ttyACM0'

Possible causes:
- Selected Bootloader version does not match the one on Bluefruit device.
    Please upgrade the Bootloader or select correct version in Tools->Bootloader.
- 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.

tlpada
 
Posts: 76
Joined: Thu Feb 27, 2020 2:38 pm

Re: Arduino on CLUE black screen

by dastels on Mon Apr 27, 2020 3:26 pm

Double check that you have the correct board selected in the Tools menu.

"Device or resource busy" often (for me anyway) means that a terminal session is open on the port (e.g. I forget to close minicom before trying to upload).

Dave

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

Re: Arduino on CLUE black screen

by tlpada on Tue Apr 28, 2020 10:16 pm

Hi, thanks for reply Dave. Yes confirmed the board is "Adafruit Feather nRF52840 Express" -- confirmed by the "Tools" bar selection, the settings in "~/.arduino15/preferences.txt", and the lower right status bar in attached picture (circled in green). It's always shown that as the board.

arduino-ide.jpg
Arduino IDE showing board
arduino-ide.jpg (242.64 KiB) Viewed 123 times


When I can get it to load, sometimes Blink seems to work, in that it fades the back red LED on the CLUE in and out. (And could you please confirm, do I have to have the CLUE board in DFU mode -- i.e. press the reset button twice, but not actually mount the file system (right?) -- every time I change code and want to 'upload' it? If I change the code slightly, and then try to upload it, I get the serial port block complaints, and then it takes several tries of resetting, resetting into DFU, plugging and unplugging the CLUE board from the USB port, etc., to get it to compile and seemingly upload again. It seems very arduous and wrong.)

Regardless of Blink, no application from 'File->Examples' that involves displaying or printing to the screen works. It's always just black on the display, even if the application compiles and uploads (apparently) successfully.

Any ideas what's wrong?

tlpada
 
Posts: 76
Joined: Thu Feb 27, 2020 2:38 pm

Re: Arduino on CLUE black screen

by dastels on Wed Apr 29, 2020 9:01 am

You have a CLUE board and building for a Feather nRF52840. That's a problem to start with. You should have "Adafruit CLUE" selected as the board.

Dave

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

Re: Arduino on CLUE black screen

by tlpada on Wed Apr 29, 2020 2:03 pm

Thanks Dave. Ha/d'oh, well, yes one would think that would help lol. But it still doesn't, it seems. First an explanation for that board, I have been following the CLUE Arduino setup guide, at https://learn.adafruit.com/adafruit-clue?view=all#arduino-support-setup, from the beginning. Under "1. BSP Installation," it says "Once the BSP is installed, select 'Adafruit Bluefruit nRF52832 Feather' (for the nRF52 Feathger [sic]) of 'Adafruit Bluefruit nRF52840 Feather Express' (for the nRF52840 Feather) from the Tools -> Board menu, which will update your system config to use the right compiler and settings for the nRF52." I was always puzzled by this -- and kept going back to it to check I was reading it right (I now see that later down the page it does indeed add a third option "Select Tools > Board > Adafruit CLUE for the Adafruit CLUE") -- but since I don't have any experience with Adafruit's Feather line, I assumed that since my CLUE does indeed say it's a "nRF52840 BLE" chipset, both on this same webpage and confirmed as etched on the back of the CLUE board itself, I assumed that this guide must mean what it says, so that's why I chose the nRF52840 Feather Express as the board. Also, side note, the guide, later down, says "2. Select the USB CDC Serial Port" -- but the only port I have available is "/dev/ttyACM0" (Adafruit CLUE)", pic attached below. Is that right, even though I am connecting to the CLUE over USB?

So yes now I see that the Arduino IDE Tools bar does indeed include Adafruit CLUE (never saw that until now) as a choice. So, I selected it. But then, same thing, tried to compile and upload several 'Examples'.. It does upload more reliably, for more scripts (though I still have to reboot into DFU mode every time it seems). But still result is the same: display is blank/black for every app I try.

Can you point me to a particular script/code that I could test -- one that will prove whether or not display, in particular, works -- so that we can control this diagnostic/troubleshooting?

Thanks.

port.jpg
port
port.jpg (63.12 KiB) Viewed 118 times

tlpada
 
Posts: 76
Joined: Thu Feb 27, 2020 2:38 pm

Re: Arduino on CLUE black screen

by dastels on Wed Apr 29, 2020 6:59 pm

Follow the instruction here for a good test/demo: https://learn.adafruit.com/adafruit-clue/arduino-test.

Dave

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

Re: Arduino on CLUE black screen

by tlpada on Thu Apr 30, 2020 12:35 am

Thanks Dave, got that working! (at least once, anyway)

Only thing though, it still takes me several tries and random sequences to get it to work without getting the 'could not open serial port' or 'serial port busy' errors. At one point I thought having more than one Arduino IDE window/sketch open caused the problem, because closing it one time resulted in the other window's sketch successfully uploading.... only to be unable to reproduce this trick again -- I'd start getting the same errors with just a single window, if I tried to open, compile, and upload a different Arduino program/sketch. And it was never clear whether "DFU mode" was required etc.

Could you please advise what the "correct" sequence for plugging in the board, resetting/putting in DFU mode or not, and then opening, compiling, and uploading code, etc. is? For example:

- Connecting the CLUE board via USB to, in my case, a linux laptop
- Clicking the CLUE reset button twice
- NOT mounting the CLUEBOOT filesystem though, as the linux desktop prompts me to do (is this right, don't mount it?)
- Opening the code file in Arduino IDE. Maybe changing it a bit, etc.
- Hit compile & upload (sometimes it fails here)
- Load a different program/script
- Hit compile & upload again (often this fails)
- Click the CLUE reset button twice again? (sometimes it makes a difference, sometimes it doesn't)
- Unplug, re-plug in CLUE board to USB port, repeat some/all of above steps? (sometimes seems to make a difference, sometimes not)
- etc..

Here are the two most frequent versions of the serial bus errors I get:

Code: Select all | TOGGLE FULL SIZE
Sketch uses 98748 bytes (12%) of program storage space. Maximum is 815104 bytes.
Global variables use 15440 bytes (6%) of dynamic memory, leaving 233392 bytes for local variables. Maximum is 248832 bytes.
processing.app.debug.RunnerException
        at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:152)
        at cc.arduino.UploaderUtils.upload(UploaderUtils.java:77)
        at processing.app.SketchController.upload(SketchController.java:732)
        at processing.app.SketchController.exportApplet(SketchController.java:703)
        at processing.app.Editor$UploadHandler.run(Editor.java:2047)
        at java.lang.Thread.run(Thread.java:748)
Caused by: processing.app.SerialException: Error touching serial port '/dev/ttyACM0'.
        at processing.app.Serial.touchForCDCReset(Serial.java:107)
        at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:136)
        ... 5 more
Caused by: jssc.SerialPortException: Port name - /dev/ttyACM0; Method name - openPort(); Exception type - Port busy.
        at jssc.SerialPort.openPort(SerialPort.java:164)
        at processing.app.Serial.touchForCDCReset(Serial.java:101)
        ... 6 more
and

Code: Select all | TOGGLE FULL SIZE
Upgrading target on /dev/ttyACM0 with DFU package /tmp/arduino_build_283667/central_scan.ino.zip. Flow control is disabled, Single bank, Touch disabled

Failed to upgrade target. Error is: Serial port could not be opened on /dev/ttyACM0. Reason: [Errno 16] could not open port /dev/ttyACM0: [Errno 16] Device or resource busy: '/dev/ttyACM0'
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/serial/serialposix.py", line 265, in open
    self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
OSError: [Errno 16] Device or resource busy: '/dev/ttyACM0'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tlp/.local/lib/python3.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 113, in open
    self.serial_port = Serial(port=self.com_port, baudrate=self.baud_rate, rtscts=self.flow_control, timeout=self.timeout)
  File "/usr/lib/python3.7/site-packages/serial/serialutil.py", line 240, in __init__
    self.open()
  File "/usr/lib/python3.7/site-packages/serial/serialposix.py", line 268, in open
    raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 16] could not open port /dev/ttyACM0: [Errno 16] Device or resource busy: '/dev/ttyACM0'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tlp/.local/lib/python3.7/site-packages/nordicsemi/__main__.py", line 294, in serial
    dfu.dfu_send_images()
  File "/home/tlp/.local/lib/python3.7/site-packages/nordicsemi/dfu/dfu.py", line 235, in dfu_send_images
    self._dfu_send_image(HexType.APPLICATION, self.manifest.application)
  File "/home/tlp/.local/lib/python3.7/site-packages/nordicsemi/dfu/dfu.py", line 157, in _dfu_send_image
    self.dfu_transport.open()
  File "/home/tlp/.local/lib/python3.7/site-packages/nordicsemi/dfu/dfu_transport_serial.py", line 115, in open
    raise NordicSemiException("Serial port could not be opened on {0}. Reason: {1}".format(self.com_port, e))
nordicsemi.exceptions.NordicSemiException: Serial port could not be opened on /dev/ttyACM0. Reason: [Errno 16] could not open port /dev/ttyACM0: [Errno 16] Device or resource busy: '/dev/ttyACM0'

Possible causes:
- Selected Bootloader version does not match the one on Bluefruit device.
    Please upgrade the Bootloader or select correct version in Tools->Bootloader.
- 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.
Thanks

tlpada
 
Posts: 76
Joined: Thu Feb 27, 2020 2:38 pm

Re: Arduino on CLUE black screen

by dastels on Thu Apr 30, 2020 8:52 am

First make sure there's actually nothing using that port. I'll quite often forget that I have a terminal open on it watching Serial output.

Beyond that I haven't found a predictable way of getting uploads to work, but once it does it seems to for a while. What seems to work bets it double-reset while the uploader is looking for the port.

Dave

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

Please be positive and constructive with your questions and comments.