Tag Archives: Ubuntu

Compiling NodeMCU ESP32 Firmware

Recently I’ve been doing some experimenting with the NodeMCU ESP8266 and ESP32-S chips to use in home automation, sending data back to my Samsung SmartThings system. The ESP32 is considered a development board and as such not everything works as expected. One of the issues I was having was the ADC isn’t very linear resulting in some of my analog inputs being pretty far off (over 4%). With that said the firmware is being updated pretty regularly so I wanted to compile a new version. I attempted to follow the instructions available (https://nodemcu.readthedocs.io/en/dev-esp32/en/build/) but was having trouble. Finally I created a Ubuntu 16.04.3 LTS virtual machine using VirtualBox but then ran into a bunch of other issues since it didn’t have any of the dependencies installed. Well after some experimenting I got it working and here are the steps:

  1. Install Ubuntu 16 (should work with 17 also)
  2. Update it (search for update and launch the software updater)
  3. Drop to a terminal (CTRL+ALT+T), typing each item, and press enter:
    • sudo apt-get update
    • sudo apt-get upgrade
    • sudo apt-get install libncurses5-dev libncursesw5-dev flex bison gperf python-serial
    • sudo apt-get install git
  4. In the same terminal window grab the firmware code: “git clone --branch dev-esp32 --recurse-submodules https://github.com/nodemcu/nodemcu-firmware.git nodemcu-firmware-esp32
  5. Move to the source directory with “cd nodemcu-firmware-esp32”
  6. Start up the menu using “make menuconfig”

You should now be able to select your config options and save a sdkconfig file that you can use to make the firmware. Now I couldn’t save the sdkconfig in the same directory and ended up saving it to my home directory then making a copy of the modemcu-firmware-esp32 directory, pasting the config in there, and running make from there to compile. I’m assuming this is because I used git to pull down the repo and its read only (compiling from the copy with my sdkconfig worked so I didn’t try to figure it out).

If you want to get fancy you can also share out your USB through VirtualBox and flash the chip from the virtual machine using make flash but I didn’t like that idea so I transferred out the NodeMCU.bin from the build directory to my host machine (Windows 10) and used NodeMCU-PyFlasher-2.0 to flash to firmware. Afterward I found that my ADC’s, while not 100% accurate, were a lot closer. Hopefully they keep making progress on this chip as it seems like a very capable replacement to the ESP8266.

Getting Broadcom Wireless Working on Ubuntu 14 (Dell Inspiron 1501)

Recently we changed out a bunch of rarely used training PC’s, Dell Inspiron 1501’s, for newer models. The Dells were definitely past their prime but I’d hate to throw them out since they all looked good and had almost no wear. From previous memory ad hard drive upgrades I had a stack of DDR2 memory and some decent mechanical drives so I decided to upgrade all of them as much as possible and find a OS that would run on them.

The best I could muster was 1.5Gb of RAM each and some 160Gb 7200 RPM drives. After a quick search it looked like Ubuntu 14 was my best bet (16 has a 2Gb memory minimum). I created a Ubuntu 14 USB drive using Universal USB Installer (http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/), hooked up the ethernet cord, and booted it. At the install screen I selected the option to download updates and also to isntall third party software. Little did I know that third party software checkbox was going to cause me lost of headaches.

Turns out some firmware for the Broadcom cards is installed by that option which renders the wired and wireless connection in these laptops dead. After lots and lots of searching I found someone that posted how to remove it. Unfortunately there steps didn’t work for me but eventually I found ones that did.

Before I fixed the wireless/wired issue I found that these machines freeze during a shutdown or reboot. Some searching for that issue led me to here http://askubuntu.com/questions/523638/why-does-ubuntu-freeze-during-reboot-14-04-lts and editing the grub config file (CTRL+ALT+T for terminal) with:

sudo gedit /etc/default/grub

And changing these two lines as listed:

GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash reboot=acpi”
GRUB_CMDLINE_LINUX=”acpi”

Once thats fixed run the following to remove the current Broadcom stuff which doesn’t seem to work on this model (or others around the same vintage):

sudo apt-get remove –purge bcmwl-kernel-source

Reboot and the wired connect should be working again. It might not reboot because the above grub changes aren’t yet in effect so let it sit for a minute on the shutdown screen then hard power it off and back on. Now to get the firmware for the wireless card and then reboot again:

sudo apt-get install firmware-b43-installer
sudo apt-get install linux-firmware-nonfree

Now both the wired and wireless should work. And I have decent working Ubuntu machines that we can give to someones kinds to mash on instead of throwing them in the garbage.