How to bulk load software into nodemcu dev kit? - lua

For development purposes I have been using the "NodeMCU Firmware Programmer" to flash the firmware to the ESP-12 NodeMCU Dev Kit V2, and then using ESPlorer to upload the lua files.
This works well for development purposes, but now we are moving into commercial production.
Is there a faster way (one-step?) to upload both the NodeMCU firmware and lua files? I need to program between 1-5k units per month.

Yes, there is a one-step way.
You first build a file system image using spiffsimg and then flash both the firmware and the image to the device (with esptool.py I suggest).

Related

esp8266 1Mbyte (512kb spiffs) missing files

I have an issue with spiffs and arduino.
I'm using ESP07 with 1mbyte of spi flash memory. I'm using arduino IDE.
I have 16 files in my file system being sketched with the option "tools -> ESP8266 Sketch data upload". If i selected 256kbytes as SPIFFS size all works fine. All files are there and the system works fine.
But if I use 512 kbytes for SPIFFS only 8 files are there after using the same "tools -> ESP8266 Sketch data upload" option.
I have verified my flash spi memory with the demo included in arduino IDE "CheckFlashConfig", it is 1mbyte.
I need to use the 512 kbytes model because the customer can upload a file that can be too big for 256kb spiffs model.
As curious stuff, I selected 2 mbytes (even when memory is 1mbyte), asigning 1.5mb/512kbspiffs and it worked fine (probably because the last bit address was ignored and it worked over 1mbyte really doing it 512/512).
I have the option to upload all those files manually and it will probably work but it is slower than just burn the memory in production.
Is it a SPIFFS bug? a problem with spiffs in arduino o maybe something that i'm missing?
Thanks.
NOTE: I'm using esp8266 community version 2.5.0 package
Since I am not allowed to comment:
Please upgrade to ESP8266 v2.6.3:
The SPIFFS as standard file system has been replaced by LittleFS (means small changes in code if using the DIR opject), but offers improvements in regard to reliability.
For testing choose Generic ESP8266 with this params 1MB (FS:512KB OTA:~246KB)
If the problem (unlikely) persists or you dont nred OTA check the partition schemes in
the following boards.txt
C:\Users\YOURUSERNAME\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\X.X.X\
dependingon theversion can be 2.5.0 or 2.6.3
- you can define your custom scheme if you like

Unable to load Lua Scripts to NodeMCU: Invalid node.chipid()

For all of these scenarios, I am able to upload the firmware and monitor via serial usb. But after creating my first firmware, for all new firmware, I can't upload Lua scripts using the nodemcu-tool without getting the following:
Error Message
F:\Development\NodeMCU\helloworld>nodemcu-tool -p COM3 upload init.lua
[NodeMCU-Tool]~ Unable to establish connection
[NodeMCU-Tool]~ Invalid node.chipid() Response: 6935962
Observations
Can reset the board using nodemcu-tool. Leads me to assume the baud rate is fine.
Can see the file system being created from PuTTy after loading any of the firmware. Leads me to assume the firmware is OK.
Have tried multiple dev boards, same results
Found the source of the error message device-info.js. either line 45 or 49
I have no idea what "Response: 6935962" means. Is that my chip id or an error code?
A new commit was made to the firmware source during the last couple of days. No idea if this is relevant.
Was hoping to get this resolved before I go down the Docker rabbit hole. Lazy. I know.
9/6/2019 - created first firmware to start development
Built a firmware using https://nodemcu-build.com/ with these modules (cron, file, gpio, i2c, mdns, mqtt, net, node, sjson, tmr, uart, wifi)
Uploaded the firmare using NodeMCU-PyFlasher-4.0
No issues with this firmware. I've been able to upload lua scripts and test them successfully. Even now, I can revert back to this firmware and use it without issues. I've even redownloaded this firmware from the original link, and it works fine.
9/7/2019 - created a new firmware to use adc and other goodies
Built a firmware using https://nodemcu-build.com/ with these modules (adc, cron, file, gpio, i2c, mdns, mqtt, net, node, rtctime, sjson, tmr, uart, wifi)
Uploaded the firmare using NodeMCU-PyFlasher-4.0
Having the problem described above.
9/8/2019 - built firmware with minimal modules
Built a firmware using https://nodemcu-build.com/ with these modules (file, gpio, net, node, tmr, uart, wifi)
Uploaded the firmare using NodeMCU-PyFlasher-4.0
Having the problem described above.
Platform & Tools
Windows 10
Development board: HiLetgo ESP8266 NodeMCU LUA CP2102 ESP-12E Internet WiFi Development Board Open Source Serial Wireless Module
Firmware builder: https://nodemcu-build.com/
Serial Monitor: PuTTy 0.72
Firmware Loader: NodeMCUPyFlasher 4.0
Lua script loader: nodemcu-tool 3.0.2
fetchDeviceInfo() first calls node.info() at https://github.com/AndiDittrich/NodeMCU-Tool/blob/master/lib/connector/device-info.js#L9. Then it does an if-else to figure out whether it's running on ESP8266 or ESP32.
With the recent upgrade to SDK 3.0 node.info() was changed in PR #2830. See documentation at https://nodemcu.readthedocs.io/en/latest/modules/node/#nodeinfo. It now returns values the script doesn't consider to be coming from ESP8266. The script then calls node.chipId() in the else branch. So, it's getting a chip id from ESP8266 but it is expecting one from ESP32. Hence, the exception.
I have no idea what "Response: 6935962" means. Is that my chip id or an error code?
It's your chip id.
To cut a long story short: NodeMCU-Tool needs to be adjusted as laid out above to work with the current NodeMCU version.
I cached the same issue from the recent cloud build(https://nodemcu-build.com/). It works when i switch back to the old ones. It looks like a problem of the build system or recent source code. You can switch to other build method and try use the older code.

Sony Spresense Arduino audio recording with digital microphones

The examples and documentation for the Spresense have a lot of very clear information, yet I think there's something missing for using digital mics with the Arduino IDE. Modifications to the extension board for using digital mics are very clearly documented with nice pictures. The Arduino example projects are great, showing you to record, encode, etc. And I've also understood you must tell the recorder to use the digital microphones with the following:
theAudio->setRecorderMode(AS_SETRECDR_STS_INPUTDEVICE_MIC_D);
There are also nice details in the audio documentation explaining that CXD56_AUDIO_MIC_CHANNEL_SEL must be changed from the default value of 0xFFFF4321, which is for analog microphones, to values for digital microphones. I've been able to follow the instructions for rebuilding the Nuttx kernel and spresense SDK with a new value of 0xCBA98765 which should enable eight digital mics. The last piece that is not clear is what nuttx/sdk binary files now need to be copied over to the Arduino environment. I have a Windows PC for use with the Arduino IDE and I have a Linux PC for building Nuttx and those examples. Can you please list which files on the Linux machine that I need to copy over to the Windows PC for the Arduino IDE to use the SDK that enables the digital mics? Sorry if this is documented somewhere and I overlooked it!
The instructions provided by Sony to record using the digital mic work fine! It was a hardware problem with my microphones. I was able to use the nuttx example named audio_recorder. I haven't tried with Arduino and the process of copying files from a nuttx build to the arduino build folders is still not very clear, but that's a separate issue.

NodeMCU module enduser_setup: Program does not compile

I built NodeMCU firmware with module enduser_setup, but when using it in Arduino IDE the compilation stops with this error:
enter code here test_:35: error: 'enduser_setup' was not declared in this scope`
Do I need to include something else?
There seems to be a fundamental misunderstanding. There are two choices but you mixed and matched them.
If you want to program the Arduino way then you don't need the NodeMCU firmware. You have to be prepared to compile and upload the entire binary to the device every time you change a single bit in your program.
If you want to program in Lua, a scripting language not too different from JavaScript, then you need to flash the NodeMCU firmware first. After that you simply upload your Lua script(s) and (re)start the execution or invoke the new functions you just uploaded. You won't need the Arduino IDE at all for this.
Disclaimer: I'm a member of the NodeMCU firmware team and thus I can't deny being slightly biased as to which approach I prefer.

Create an Apple Homekit accessory with NodeMCU (ESP8266)

My goal is to create a simple LED controlled by my iPhone through Homekit.
I'd like to do it using only a NodeMCU (ESP8266).
I found lots of solutions using a NodeJS library (HAP-NodeJS), which works well on my PC, but obviously can't run on a NodeMCU board.
As I understand, all these solutions require a RaspberryPI (or similar board running Linux) that talks with the NodeMCU board. But I don't like this solution.
Is there a way to achieve this goal only with a NodeMCU board?
Update 1 (25/01/2017)
Ok, I'm reading lots of blogs and watching some videos, and I'm understanding more about this topic.
I found NodeMCU Flasher to install the firmware on the board, and I found the firmware I'd like to use (I think I could be more comfortable with Lua).
First problem... I'm using a Mac, and NodeMCU Flasher is for Windows... Is there an alternative?
I downloaded also ESPlorer. Does it provide the same functionality as NodeMCU Flasher?
Please check this.
Public Apple's HomeKit protocol code has been around for some time for more potent processors (notably HAP-NodeJS). This is a rewrite for the ESP8266 to make the server foundation. This project uses ESP8266_RTOS_SDK and WolfCrypt 3.9.8 for the crypto. It will however NOT deliver a certified HomeKit device.

Resources