Unable to upload code to a NodeMCU Board - arduino

I have 4 NodeMCU boards, 3 of them I can use and 1 I can't seem to upload any of my code to. It does boot, and I can get a readout of it on the serial port.
On boot:
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x40100000, len 1856, room 16
tail 0
chksum 0x63
load 0x3ffe8000, len 776, room 8
tail 0
chksum 0x02
load 0x3ffe8310, len 552, room 8
tail 0
chksum 0x79
csum 0x79
2nd boot version : 1.5
SPI Speed : 40MHz
SPI Mode : DIO
SPI Flash Size & Map: 8Mbit(512KB+512KB)
jump to run user1 # 1000
rf[112] : 03
rf[113] : 00
rf[114] : 01
SDK ver: 1.5.4(baaeaebb) compiled # May 17 2016 19:23:54
phy ver: 972, pp ver: 10.1
I also tried doing a reset with the flash button held down:
ets Jan 8 2013,rst cause:2, boot mode:(1,6)
I don't get any compile errors with my code, and the code works perfectly fine on the other 3 NodeMCU boards. When I try to upload (regardless of boot mode) I see the blue light near the ESP8266 chip blink a couple of times, and then I get the following errors output:
Sketch uses 230061 bytes (22%) of program storage space. Maximum is 1044464 bytes.
Global variables use 34612 bytes (42%) of dynamic memory, leaving 47308 bytes for local variables. Maximum is 81920 bytes.
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed
I've also tried grounding D0 and connecting the EN pin to 3.3v, which changes the boot mode to ets Jan 8 2013,rst cause:2, boot mode:(1,7) and the red onboard LED turns on, but still doesn't allow me to upload code.
ENVIRONMENT (these settings work on all my other NodeMCU Boards and I did confirm this is a 1.0 board)
IDE: Arduino 1.8.0
Board: NodeMCU 1.0 (ESP-12E)
CPU: 80 MHz
Flash Size: 4M (3M SPIFFS)
Upload Speed: 115200

Related

BLE: WriteValue of GattCharacteristic doesn't get called

I followed the tutorial from The Bluetooth Technology for Linux Developers Study Guide (I skipped the 5th guide because I'm doing a gatt server), and everything worked fine until I got to Handling Characteristic Writes.
(Also, I am using a Raspberry PI 4 Model B)
In nRF Connect I have the following in the logs:
Writing request to characteristic e95d93ee-251d-470a-a062-fa1922dfa9a8
Data written to e95d93ee-251d-470a-a062-fa1922dfa9a8, value: (0x)68-65-6C-6C-6F, "hello"
"hello" sent
so the data should have been sent.
sudo btmon gives the following:
> ACL Data RX: Handle 64 flags 0x02 dlen 14 #129 [hci0] 82.584227
ATT: Prepare Write Request (0x16) len 9
Handle: 0x0019
Offset: 0x0000
Data: 68656c6c6f
< ACL Data TX: Handle 64 flags 0x00 dlen 14 #130 [hci0] 82.585053
ATT: Prepare Write Response (0x17) len 9
Handle: 0x0019
Offset: 0x0000
Data: 68656c6c6f
> HCI Event: Number of Completed Packets (0x13) plen 5 #131 [hci0] 82.814773
Num handles: 1
Handle: 64
Count: 1
so the data was indeed received. Though I don't understand why it says Prepare Write Request instead of just Write Request.
bluetoothd with -nd flag and tail -f /var/log/syslog gives the following:
Jul 28 09:20:45 raspberrypi bluetoothd[820]: bluetoothd[820]: src/device.c:gatt_debug() (chan 0x1bb9dd0) ATT PDU received: 0x16
Jul 28 09:20:45 raspberrypi bluetoothd[820]: bluetoothd[820]: src/device.c:gatt_debug() Prep Write Req - handle: 0x0019
Jul 28 09:20:45 raspberrypi bluetoothd[820]: src/device.c:gatt_debug() (chan 0x1bb9dd0) ATT PDU received: 0x16
Jul 28 09:20:45 raspberrypi bluetoothd[820]: src/device.c:gatt_debug() Prep Write Req - handle: 0x0019
but there is no reaction using sudo dbus-monitor --system, and nothing either in the program output terminal.
Do you have any Idea where the problem might come from?
(I tried reinstalling nRF Connect twice already, so I think the problem is from somewhere in the Raspberry, but is it from bluez? from dbus? or somewhere else?)
After reinstalling bluez, and not solving anything, I tried with an old samsung tablet, and it works. So it appears my assumption was wrong and the problem could be from my phone.

ESP32 phy_init partition has no size

I want to flash the ESP32-D0WDQ6 chip, but the code will not run. In the monitor I can see that the app actually never loads. The partition phy_init does not seem to have any size and the chip gets stuck after that line.
Monitor output:
rst:0x1 (POWERON_RESET),boot:0x33 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:6744
load:0x40078000,len:14236
ho 0 tail 12 room 4
load:0x40080400,len:3716
entry 0x40080680
I (28) boot: ESP-IDF v4.4-dev-1404-gc13afea63 2nd stage bootloader
I (28) boot: compile time 23:43:03
I (28) boot: chip revision: 1
I (32) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (40) boot.esp32: SPI Speed : 40MHz
I (44) boot.esp32: SPI Mode : DIO
I (49) boot.esp32: SPI Flash Size : 2MB
I (53) boot: Enabling RNG early entropy source...
I (59) boot: Partition Table:
I (62) boot: ## Label Usage Type ST Offset Length
I (70) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (77) boot: 1 phy_init RF data 01 01 0000f000 0000
My partition table:
nvs,data,nvs,0x9000,24K,
phy_init,data,phy,0xf000,4K,
factory,app,factory,0x10000,1M
Flash command:
esptool.py esp32 -p /dev/ttyACM0 -b 115200 --before=no_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 2MB 0x1000 bootloader/bootloader.bin 0x8000 partition_table/partition-table.bin 0x10000 my_project.bin
I actually found a solution to the problem:
This is the WiFi NINA W102 module, which has only 2MB of storage. The problem to it crashing was just another one: To keep the NINA running, the RESET pin has to be pulled high all time. The Arduino script pulls it low after some time by itself so keeping it pulled high when the code should be executed did the trick. There is still crashed but downgrading to a stable IDF version resolved every issue.

ESP8266 and Arduino UNO

I am trying to upload a sketch and getting below error:
Except the usual connection my GPIO 0 is grounded.
Arduino: 1.8.1 (Windows 10), Board: "Generic ESP8266 Module, 80 MHz, 40MHz,
DOUT, 115200, 512K (64K SPIFFS), ck, Serial1, All"
Sketch uses 232813 bytes (53%) of program storage space. Maximum is 434160 bytes
Global variables use 34092 bytes (41%) of dynamic memory, leaving 47828 bytes for local variables. Maximum is 81920 bytes.
error: failed reading byte
warning: espcomm_send_command: cant receive slip payload data
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
You must have a bad connection. I recommend that you follow this scheme that I leave here.
ESP01 connection with Arduino UNO
You can also consult this complete guide on the ESP01 (https://programarfacil.com/podcast/como-configurar-esp01-wifi-esp8266/) that although it is in Spanish, is very simple to follow.
Make sure GPIO 0 is grounded, and then reset the ESP8266. Also make sure you have 3.3v coming in to CH_PD and RST. Set baud rate to 115200 unless you changed it already.

How to get the ESP8266 to work in update mode?

I have been trying to get my WiFi module, ESP8266 to work in the "update mode" where you connect GPIO_0 to ground.
The board is functional when GPIO_0 is disconnected from ground and I am able to use AT commands to talk to it via the Arduino serial monitor.
Following is what it prints upon connecting:
ets Jan 8 2013,rst cause:4, boot mode:(3,6)
wdt reset
load 0x40100000, len 1396, room 16
tail 4
chksum 0x89
load 0x3ffe8000, len 776, room 4
tail 4
chksum 0xe8
load 0x3ffe8308, len 540, room 4
tail 8
chksum 0xc0
csum 0xc0
2nd boot version : 1.4(b1)
SPI Speed : 40MHz
SPI Mode : DIO
SPI Flash Size & Map: 8Mbit(512KB+512KB)
jump to run user1 # 1000
rrlÌÿ
Ai-Thinker Technology Co.,Ltd.
ready
However, I cannot do most things as the firmware is out of date.
As a result, I am trying to update it (with no success)
When I set it to update mode and use the python tool "esptool.py", the script fails to connect to the ESP board.
Following is the command:
python esptool.py -p /dev/ttyUSB0 write_flash 0x00000 "/home/aditya/Desktop/v0.9.2.2 AT Firmware.bin"
Following is the output:
Connecting...
Traceback (most recent call last):
File "esptool.py", line 532, in <module>
esp.connect()
File "esptool.py", line 159, in connect
raise Exception('Failed to connect')
Exception: Failed to connect
I have even run the Windows counterpart of this tool "ESP Flasher" with no luck
The one who helps will be given a cookie (unless you value privacy)
This tool (esptool.py) works with a ROM bootloader, which is only started if GPIO_0 is tied to the GND during hardware reset. Bootloader also times out pretty fast, so just connecting GPIO_0 to the ground is not enough.
For me, following works:
Connect TXD/RXD/GND/VCC to the PC and CH_PD to VCC;
Make sure I can talk to the firmware via terminal (picocom/minicom/etc);
Connect GPIO_0 to the GND;
Connect RST to GND;
Release RST;
Run esptool.py
If still no dice, swap 5 and 6 above, i.e. first run esptool.py, then (as quickly as possible) release/disconnect RST. You will only have a second or two before esptool.py times out.
Try making the ground of all devices connected: if you have a level shifter inbetween, make sure the GND is tied to the GND of Arduino and also to the RS232 GND.

BeagleBone Black MRF24j40

I am trying to get a MRF24j40 on a BeagleBone Black to talk to an arduino with a mrf24j40. I have successfully communicated arduino to arduino but as of yet have not been able to receive the packets being sent out on the BBB.
The setup: I have GPIO_13 going to reset (pin 2), GPIO_14 going to wake (pin 3) and GPIO_29 going to interrupt (4). The 3.3v is going to vin on 10 and ground on pin 1. I am using SPI1 with the HDMI ports disabled. D0 is mapping to pin 7 (SDO) and D1 is mapping to pin 5 (SDI), P9.31 the clock goes to pin 6 and P9.28 goes to pin 8.
I have been able to log into the BBB via ssh. I then load the cape for the MRF24j40 using the echo to /sys/devices/bone_capemgr.9/slots
This appears to load the driver properly.
I have then been able to do:
iz listphy
iz: /lib/arm-linux-gnueabihf/libnl-genl-3.so.200: no version information available (required by iz)
iz: /lib/arm-linux-gnueabihf/libnl-3.so.200: no version information available (required by iz)
wpan-phy0 IEEE 802.15.4 PHY object
page: 0 channel: n/a
channels on page 0: 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
iz add wpan-
iz: /lib/arm-linux-gnueabihf/libnl-genl-3.so.200: no version information available (required by iz)
iz: /lib/arm-linux-gnueabihf/libnl-3.so.200: no version information available (required by iz)
Registered new device ('wpan0') on phy wpan-phy0
I decided to set all my addresses to simple things on the arduino side in case there is some sort of endian problem so the pan id is 0, the address of the sender is 0 and it sends the data to 1, thus I try to set the beaglebone to pan id 0, address 1 with a destination address of 0.
root#beaglebone:~# iz set wpan0 0 1 12
iz: /lib/arm-linux-gnueabihf/libnl-genl-3.so.200: no version information available (required by iz)
iz: /lib/arm-linux-gnueabihf/libnl-3.so.200: no version information available (required by iz)
ifconfig wpan0 up
Then I run
izchat 0 1 0
I get nothing on the BBB side even though the other side is constantly transmitting... and when I type into izchat, I do not receive anything on the other side.
Any help here would be appreciated... I just want to see some data before I start coding. Like I said, this has been tested arduino to arduino and does not have problems.

Resources