What am I doing wrong? MR60BHA1 sensor on Seeed-ESP32c3
Given:
1 x Seeed MR60BHA1 sensor
1 x Seeed-ESP32c3 (XIAO)
1 x UART USB Adapter
1 x PC
Wanted:
Use MR60BHA1 sensor with ESP32c3
(later the ESP should write the heart and breathing rate into a HAPI-FHIR server via FHIR (REST in healthcare)…)
My approach:
1.) If I connect the MR60BHA1 sensor to the PC via the UART USB adapter, the seeed demo program displays the heart and breathing rate; So the sensor works; The latest firmware is also on it
2.) I load my own software onto the ESP32c3, the ESP also works great and sends the data to my REST server via http-POST via WLAN; So the ESP32c3 works too
5.) Compile and load the original seeed sketch (MR60BHA1_Breath_heartbeat_inf_output.ino) onto the ESP32c3 via USB, this also works. The message appears: “Leaving…Hard resetting via RTS pin…” and open the “serial monitor” of the IDE…
Comes my problem:
The error message: “Timeout. The IDE has not received the ‘success’ message from the monitor after successfully connecting to it. Could not connect to COM5 serial port.”
If I pull the USB cable out of the ESP32c3 and plug it back in then Windows reports a faulty USB device. Pressing the RESET button on the ESP32c3 doesn’t help either. After correctly pressing the REBOOT sequence, the ESP32c3 is found again by the operating system and the IDE but the sketch does not run (I think).
Does somebody has any idea?
Thank you for your help and greetings from Berlin!
Sam
Hi there , If I may.
So under NORMAL Compile and upload scenario Only setting the right board and port and the IDE does the rest no buttons to touch or push. After a Bad Code upload (i.e. the code is bad) but upload is fine as Normal, After resetting the result is a boot loop or other unexpected behavior. (maybe over-wrote some bootloader memory location or something out of bounds) in any case Now trying to upload a fixed code or Know good code The IDE and Chip are not syncing and acting Normal.
NOW the only uploads that will work require the buttons to get it in the Mode.
Can you get the prompt like What I get if I hold the boot button down and tap and release the reset button?
My Serial monitor looks like this output (note the last line?)
ESP32 Chip model = ESP32-C3 Rev 3
This chip has 1 cores
Chip ID: 4170632
ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0x0 (USB_BOOT)
Saved PC:0x400462dc
**wait usb download** <--------**
Try that and upload again. Your close.
HTH
GL PJ
ps. Here’s the Basic Known good Upload I use when things get funny…
/* The true ESP32 chip ID is essentially its MAC address.
This sketch provides an alternate chip ID that matches
the output of the ESP.getChipId() function on ESP8266
(i.e. a 32-bit integer matching the last 3 bytes of
the MAC address. This is less unique than the
MAC address chip ID, but is helpful when you need
an identifier that can be no more than a 32-bit integer
(like for switch...case).
created 2020-06-07 by cweinhofer
with help from Cicicok */
// Test code to get chip ID and STUFF
uint32_t chipId = 0;
int Vibration_signal = B10;
int Sensor_State = 1;
void setup() {
Serial.begin(9600);
delay (2000);
for(int i=0; i<17; i=i+8) {
chipId |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i;
}
pinMode(Vibration_signal,INPUT);
Serial.begin(9600);
Serial.printf("ESP32 Chip model = %s Rev %d\n", ESP.getChipModel(), ESP.getChipRevision());
Serial.printf("This chip has %d cores\n", ESP.getChipCores());
Serial.print("Chip ID: "); Serial.println(chipId);
}
void loop() {
delay(3000);
}
here is the compile output. just FYI.
FQBN: esp32:esp32:XIAO_ESP32C3
Using board 'XIAO_ESP32C3' from platform in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.8
Using core 'esp32' from platform in folder: C:\Users\Dude\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.8
loading library from d:\Arduino_projects\libraries\arduino-esp32-master: invalid library: no header files found
cmd /c if exist "D:\\Arduino_projects\\GetChipID\\partitions.csv" COPY /y "D:\\Arduino_projects\\GetChipID\\partitions.csv" "C:\\Users\\Dude\\AppData\\Local\\Temp\\arduino\\sketches\\B0BFC6AD928EE0E6D13E03AD142A923F\\partitions.csv"
cmd /c if not exist "C:\\Users\\Dude\\AppData\\Local\\Temp\\arduino\\sketches\\B0BFC6AD928EE0E6D13E03AD142A923F\\partitions.csv" if exist "C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.8\\variants\\XIAO_ESP32C3\\partitions.csv" COPY "C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.8\\variants\\XIAO_ESP32C3\\partitions.csv" "C:\\Users\\Dude\\AppData\\Local\\Temp\\arduino\\sketches\\B0BFC6AD928EE0E6D13E03AD142A923F\\partitions.csv"
cmd /c if not exist "C:\\Users\\Dude\\AppData\\Local\\Temp\\arduino\\sketches\\B0BFC6AD928EE0E6D13E03AD142A923F\\partitions.csv" COPY "C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.8\\tools\\partitions\\default.csv" "C:\\Users\\Dude\\AppData\\Local\\Temp\\arduino\\sketches\\B0BFC6AD928EE0E6D13E03AD142A923F\\partitions.csv"
cmd /c IF EXIST "D:\\Arduino_projects\\GetChipID\\bootloader.bin" ( COPY /y "D:\\Arduino_projects\\GetChipID\\bootloader.bin" "C:\\Users\\Dude\\AppData\\Local\\Temp\\arduino\\sketches\\B0BFC6AD928EE0E6D13E03AD142A923F\\GetChipID.ino.bootloader.bin" ) ELSE ( IF EXIST "C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.8\\variants\\XIAO_ESP32C3\\bootloader.bin" ( COPY "C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.8\\variants\\XIAO_ESP32C3\\bootloader.bin" "C:\\Users\\Dude\\AppData\\Local\\Temp\\arduino\\sketches\\B0BFC6AD928EE0E6D13E03AD142A923F\\GetChipID.ino.bootloader.bin" ) ELSE ( "C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esptool_py\\4.5.1/esptool.exe" --chip esp32c3 elf2image --flash_mode dio --flash_freq 80m --flash_size 4MB -o "C:\\Users\\Dude\\AppData\\Local\\Temp\\arduino\\sketches\\B0BFC6AD928EE0E6D13E03AD142A923F\\GetChipID.ino.bootloader.bin" "C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.8\\tools\\sdk\\esp32c3\\bin\\bootloader_qio_80m.elf" ) )
esptool.py v4.5.1
Creating esp32c3 image...
Merged 1 ELF section
Successfully created esp32c3 image.
cmd /c if exist "D:\\Arduino_projects\\GetChipID\\build_opt.h" COPY /y
**EDIT for brevity**
"C:\\Users\\Dude\\AppData\\Local\\Temp\\arduino\\sketches\\B0BFC6AD928EE0E6D13E03AD142A923F/GetChipID.ino.partitions.bin"
cmd /c if exist "C:\\Users\\Dude\\AppData\\Local\\Temp\\arduino\\sketches\\B0BFC6AD928EE0E6D13E03AD142A923F\\libraries\\Insights" "C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.8/tools/gen_insights_package.exe" "C:\\Users\\Dude\\AppData\\Local\\Temp\\arduino\\sketches\\B0BFC6AD928EE0E6D13E03AD142A923F" GetChipID.ino "D:\\Arduino_projects\\GetChipID"
cmd /c IF 0==1 COPY /y "C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\openocd-esp32\\v0.11.0-esp32-20221026\\share\\openocd\\scripts\\board\\esp32c3-builtin.cfg" "D:\\Arduino_projects\\GetChipID\\debug.cfg"
cmd /c IF 0==1 COPY /y "C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.8\\tools\\ide-debug\\esp32c3.json" "D:\\Arduino_projects\\GetChipID\\debug_custom.json"
cmd /c IF 0==1 COPY /y "C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.8\\tools\\ide-debug\\svd\\esp32c3.svd" "D:\\Arduino_projects\\GetChipID\\debug.svd"
"C:\\Users\\Dude\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\riscv32-esp-elf-gcc\\esp-2021r2-patch5-8.4.0/bin/riscv32-esp-elf-size" -A "C:\\Users\\Dude\\AppData\\Local\\Temp\\arduino\\sketches\\B0BFC6AD928EE0E6D13E03AD142A923F/GetChipID.ino.elf"
Sketch uses 229918 bytes (17%) of program storage space. Maximum is 1310720 bytes.
Global variables use 15856 bytes (4%) of dynamic memory, leaving 311824 bytes for local variables. Maximum is 327680 bytes.
"C:\Users\Dude\AppData\Local\Arduino15\packages\esp32\tools\esptool_py\4.5.1/esptool.exe" --chip esp32c3 --port "COM3" --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x0 "C:\Users\Dude\AppData\Local\Temp\arduino\sketches\B0BFC6AD928EE0E6D13E03AD142A923F/GetChipID.ino.bootloader.bin" 0x8000 "C:\Users\Dude\AppData\Local\Temp\arduino\sketches\B0BFC6AD928EE0E6D13E03AD142A923F/GetChipID.ino.partitions.bin" 0xe000 "C:\Users\Dude\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.8/tools/partitions/boot_app0.bin" 0x10000 "C:\Users\Dude\AppData\Local\Temp\arduino\sketches\B0BFC6AD928EE0E6D13E03AD142A923F/GetChipID.ino.bin"
esptool.py v4.5.1
Serial port COM3
Connecting...
Chip is ESP32-C3 (revision v0.3)
Features: WiFi, BLE
Crystal is 40MHz
MAC: a0:76:4e:3f:a3:88
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00003fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x0004afff...
Compressed 13152 bytes to 9473...
Writing at 0x00000000... (100 %)
Wrote 13152 bytes (9473 compressed) at 0x00000000 in 0.2 seconds (effective 465.9 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 146...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (146 compressed) at 0x00008000 in 0.0 seconds (effective 521.8 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 686.8 kbit/s)...
Hash of data verified.
Compressed 241392 bytes to 135035...
Writing at 0x00010000... (11 %)
Writing at 0x0001ab5d... (22 %)
Writing at 0x00022680... (33 %)
Writing at 0x000284bc... (44 %)
Writing at 0x0002e652... (55 %)
Writing at 0x0003462c... (66 %)
Writing at 0x0003c270... (77 %)
Writing at 0x00042fc0... (88 %)
Writing at 0x0004958f... (100 %)
Wrote 241392 bytes (135035 compressed) at 0x00010000 in 2.1 seconds (effective 932.3 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
Thank you very much for your help, especially PJ_Glasso and Citric.
Apparently it was the source code of the seeed-example program itself. In the Wiki (>>> Pin Multiplexing | Seeed Studio Wiki) I found another variant with “PIN multiplexing” and it works perfectly (no faulty USB device and Heartbeat in the terminal/serial Monitor).