No processor COM port when following STM32 // Cellular Function Board tutorial

Hello!

This is my first time working with hardware and I’m not sure where I’ve gone awry. Apologies if I’m asking something blindingly obvious, but I did a fair bit of debugging prior to coming here. :slight_smile:

I am trying to do this tutorial: Sensor Tutorial with C/C++ (Arduino/Wiring), SparkFun MicroMod STM32 Processor, and SparkFun MicroMod Cellular Function Board - Blues Developers and am using Windows 10.

I am not seeing what I feel is correct behavior after uploading a sketch. I will describe the steps I’ve taken to debug.

Prior to the tutorial, and prior to attempting to upload a sketch, I plugged a USB cable into the function board, went to https://dev.blues.io/terminal/, and connected to my device. The console displayed two warnings. The first one suggested I set my product UID and the second suggested I update my firmware. I updated my product UID through the terminal. My firmware was very out-of-date and I was unable to update it through the online terminal. Instead, I went to Notehub, devices, notecard firmware, and told it to update to the latest development release. This succeeded and I am currently on v7.2.2.16518

After updating the firmware, I began to explore the tutorial mentioned above.

So, to start, the tutorial shows a USB cable plugged into the main board rather than the function board. I don’t understand the functional difference here, and I was previously plugged into the function board, but I swapped to being plugged into the main board as to follow the example.

After plugging it in, I put the device into DFU mode by holding boot and tapping reset. I am able to confirm this works well by going into Device Manager. I see an entry “STM32 BOOTLOADER” under Universal Serial Bus devices.

I upload this code:

#include <Notecard.h>
#define productUID "com.gmail.Meo.DDR:feed_connect"
#define usbSerial Serial

Notecard notecard;

void setup() {
  delay(2500);

  // put your setup code here, to run once:
  usbSerial.begin(115200);

  notecard.begin();
  notecard.setDebugOutputStream(usbSerial);

  J *req = notecard.newRequest("hub.set");
  JAddStringToObject(req, "product", productUID);
  JAddStringToObject(req, "mode", "continuous");
  notecard.sendRequest(req);
}

void loop() {
  // put your main code here, to run repeatedly:
}

I receive no error messages. The output reads:

Sketch uses 42684 bytes (4%) of program storage space. Maximum is 1048576 bytes.
Global variables use 1340 bytes (1%) of dynamic memory, leaving 129732 bytes for local variables. Maximum is 131072 bytes.
      -------------------------------------------------------------------
                       STM32CubeProgrammer v2.16.0                  
      -------------------------------------------------------------------



USB speed   : Full Speed (12MBit/s)
Manuf. ID   : STMicroelectronics
Product ID  : STM32  BOOTLOADER
SN          : 325037773132
DFU protocol: 1.1
Board       : --
Device ID   : 0x0413
Device name : STM32F405xx/F407xx/F415xx/F417xx
Flash size  : 1 MBytes (default)
Device type : MCU
Revision ID : --  
Device CPU  : Cortex-M4


Memory Programming ...
Opening and parsing file: sketch_may17b.ino.bin
  File          : sketch_may17b.ino.bin
  Size          : 42.25 KB 
  Address       : 0x08000000 


Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 2]
sector 0000 does not exist
sector 0001 does not exist
sector 0002 does not exist
Download in Progress:


File download complete
Time elapsed during download operation: 00:00:01.202

RUNNING Program ... 
  Address:      : 0x8000000
Start operation achieved successfully

This looks like a good outcome to me.

At this point, the tutorial states “you can use a Serial Monitor to view device output”. I had previously been observing device output through the online terminal, but that was when my USB cable was plugged in to the function board.

When I open Serial Monitor in Arduino IDE (v2.3.2) I get an error. It reads, “Not connected. Select a board and a port to connect automatically.” There is no COM port identified in device manager and Tools → Port in Arduino IDE is greyed out and reads PORT: “COM3”

I became confused at this point and started trying to debug further.

If I take a second USB cable and plug it into the function board then Device Manager shows a USB Serial Device (COM3) under Ports and Serial Monitor begins to function. This isn’t described in the tutorial at all and it’s unclear to me if this is necessary or a red herring.

I’m not able to upload a sketch to the processor if I’m just plugged in to the function board. So, it seems like both USB ports are providing some value, but that conflicts with the tutorial.

Anyway, I still hadn’t seen any serial output in my IDE and I wasn’t sure if my sketch had worked at all. So, I set the Arduino IDE Serial Monitor’s baud to 115200 and issued a command with both USB cables plugged in. I sent {"req":"hub.get"}

and the response I received was:

{"mode":"periodic","host":"a.notefile.net","product":"com.gmail.Meo.DDR:feed_connect","device":"dev:867730051124885"}

I note that the mode is periodic, but that the tutorial code sets it to continuous. So, I do not think the tutorial code has executed. I believe the product is set properly because of the configuration I did through the web terminal.

I then hit “reset” on the main board. My intent here is to re-run the uploaded code with the serial monitor open. I feel that I should see some information written in the terminal after a delay, but nothing is written.

At this point I become pretty confused. I feel that I should not need two USB cables and that I should get an open COM port when plugging in to the main board, but that doesn’t happen. I know my computer sees the processor because when I put it in DFU I see it in Device Manager. I know I can write to the function board fine through the web terminal. I get no error when I upload a sketch.

It seems like something about the sketch isn’t uploading right and it’s not taking effect, but I’m not sure how to debug further.

Am I missing something blindingly obvious here?

Thanks for your time.

Hi @Meo and welcome to the Blues community!

My guess is that you’ve stumbled across a known issue with STM32CubeProgrammer version 2.16. Can you try uninstalling that and instead installing 2.15 to see if that helps while we wait for ST to fix this issue?

Rob

Thanks for the tip, @RobLauer I’ll give that a shot and report back shortly.

EDIT: progress!!

I still don’t see logging working, but I do see the code work now and my device has been set to continuous mode. So that’s great, I’ll see what more tinkering can do from here.

EDIT2: solved!

I went into Arduino IDE and set CDC under USB support. Then my MCU identified as a COM port and hello world logged fine. This was all prevented by the issue described above, but wasn’t too bad to figure out afterward.

Cheers!

1 Like