I am using esp32 smartconfig to setup wifi credentials and it is working reliably. I want to be able to erase the credentials which are stored somewhere in flash from my arduino esp32 sketch.
The only way I have been able to erase the credentials (I'm not sure where they are stored) is to erase the entire flash using esptool.py from my Windows PC:
esptool.py --chip esp32 --port com8 erase_flash
I would like to just be able to erase the credentials from my sketch so a user without a pc would have this capability.
Thanks.
You haven't provided much details on your implementation, but if assuming the standard ESP-IDF implementation then the WiFi credentials are stored in Flash on the default NVS partition named "nvs" (overview). You can easily perform an erase cycle on the entire partition which will erase everything stored in your device.
Alternatively you can hunt down the specific NVS keys used by the ESP WiFi component to store the credentials and erase only those. This is slightly risky as they haven't open-sourced the WiFi drivers and might change the implementation at any time. With that in mind, current ESP IDF 4.2 seems to store those keys in the default NVS partition under namespace "nvs.net80211". The relevant key names would appear to be "sta.authmode", "sta.ssid" and "sta.pswd".
Anyone else bumps into this, there is esp_wifi_restore() which will clear the wifi credentials without wiping out the NVS.
Source [https://github.com/espressif/esp-idf/issues/4108]
If you're using PlatformIO on VSCode you have the option "Erase Flash" in Platform IO left menu (when you click on ET head at the 'left' menu).
Be sure the ESP was reseted and in flash mode. (same to place a new code on it)
Erasing flash
Related
I have created a custom code for ESp32 in Arduino IDE. I flashed the program directly from IDE using UART with the help of TTL. I'm looking for an alternative method to flash the firmware of ESP32.
I'm trying to flash the esp32 binary file generated from Arduino IDE, using the flash downloader tool.
https://www.espressif.com/en/support/download/other-tools
I have used the configuration settings as follows
This settings flashed the firmware and the board reset worked perfectly. The SPIFFS did not however work.
Please find the log attached.
Also attached the reset log after flashing for reference
Thanks for the help.
So, I programmed an ATMEGA32u4 and when I connect the device, it doesn't run the code. Instead, it gets recognised as an ATMEGA32u4 chip in Windows device manager.
To get the code running I have to open Atmel FLIP and open USB and then have to press the start application button after which it gets recognised as a HID in device manager and works as intended. I don't know why and what is happening.
The reset is pulled high with a 10k and the HWB is pulled down with a 10k and the chip has the factory bootloader on it.(if this helps)
Pulling down HWB is what you do if you want to start the bootloader built into the ATmega32U4. It sounds like you want to run your own code instead of running the bootloader so you should pull HWB up, or disable the HWBE fuse.
I have a crypto USB device which is used to store PKI certificates including the private key.
It can be read/written to using the Microsoft Crypto APIs. And it is protected by a PIN. I am investigating if the device is in fact secure.
In my opinion, the security of the device hinges on how the PIN is used/stored. This is related to a different question I posted on crypto.stackexchange - https://crypto.stackexchange.com/questions/5929/crypto-usb-devices-where-is-the-pin-password-stored
When I insert the device into my USB slot, it presents itself as a CD drive containing a setup program which installs the driver/CSP middleware/UI for the device. After the setup program is run and I store certificates in the device, I still see only the setup program in Windows Explorer when I look at the drive assigned for the device.
So in order to prove that the device is secure or not secure, I want to access the raw data on the device. And I want to know what APIs on Windows, I can use to access the device bypassing the Crypto APIs.
Alternately are there tools to do the same?
One idea would be to boot into a Linux Live CD and view the drive contents that way. You could, for example, try one of the latest Ubuntu builds, all of which can be run from the CD without installing the operating system onto your Windows machine.
My theory is that when your device is accessed from Linux, the raw data will be available. When it is accessed from Windows, I suspect some kind of clever AutoPlay comes into effect in order to present your device as a CD drive.
I'm using a Limited User account under Windows XP, and I'm having a bit of trouble getting my Adaptoid (the most coveted N64 controller -> USB adapter, because of it's support for sending raw N64 controller commands + the fact that it's been discontinued) to work smoothly: as installed, the included software requires Administrator privileges to load the driver.
Presumably, it is possible to arrange for the driver to be loaded automatically when the Adaptoid is inserted by adding some stuff to the INF file for the driver (wishna1.inf):
the question is, what stuff?
(It would also suit me just as well if the driver could be automatically loaded when anything attempted to open \Device\Wish_NA1, or even to have it automatically loaded at every boot, really, but doing it on insertion seems like the right way.)
Note: I do have access to an administrative account, it's just that I prefer not to have to use it day-to-day.
First of all, let's clarify that a USB device has a Plug & Play driver on Windows 2000 and higher, so services start modes are irrelevant. The driver will have an entry as a "service" in the registry, but its start mode is irrelevant here.
Let's split the problem into two parts:
Installing driver for the device: This requires administrative privileges. This happens when you insert a USB device into a port for the first time. Windows goes over your .INF files to find one that matches your hardware. If the driver is WHQL-certified, it'll load automatically. Otherwise, you'd see the dreaded Add New Hardware wizard. If you're running as admin, a few clicks on Next should be enough to install it. Otherwise, better have that Administrator password ready.
Loading the driver for the device: Once the device is installed, the driver will be loaded each time this device is inserted into this USB port without requiring any additional user intervention. Ever noticed how a USB printer, camera or disk drive load much faster the second time you plug it in? That's because that's just loading, without installing.
From looking at the .INF, it looks valid. Also, it's not WHQL-certified, so you'd have to install it manually.
I'm assuming when you insert the Adaptoid, you get an Add New Hardware wizard. If you point it manually to the installation directory, does the Adaptoid install and function? Does it appear in the Device Manager?
P.S. USB devices which have a serial number are an exception. They're installed once for all USB ports. Those devices are rather uncommon, though.
I am working at a client site where there is a proxy server (HTTP) in place. If I do a hard reset of the emulator it forgets network connection settings for the emulator and settings in the hosted Windows Mobile OS. If I 'save state and exit' it will lose all of these settings. I need to do hard resets regularly which means that I lose this information and spend a lot of time setting:
The emulators associated network card
DNS servers for network card in the WM OS.
Proxy servers in connection settings of WM OS.
How can I make my life easier? Can I save this as defaults in the emulator, or create an installer easily?
There is a way you can programmatically provision your devices. If you're using managed code, you can use Microsoft.WindowsMobile.Configuration.dll to do most of the work for you. If you're using unmanaged code, you have to use DMProcessConfigXML native function.
There's more details in this blog post by Andrew Arnott.
The problem with these devices is everything is stored in the RAM and ROM. So you need a second alternate device storage for these settings, just like a real device. So that when a real device, or your device is reset, it has a statically stored configuration file outside of the RAM that can be loaded on start up. The alternative is to do soft-resets if possible.