Uploading code from platform IO to esp32 - visual-studio-code

I'm sorry for that stupid question but I really can't find what I need.
I made a code to use a ESP Wrover 32 with PlatformIO/VScode and I need to upload the code to the ESP32 (connected to the computer using USB) but I can't find how to select the right USB port to upload the code.
The error is :
Please specify 'upload_port' for environment or use global
'--upload-port' option.
I tried to use the command lines but nothing works.
How can I upload my code ?
Thanks

To find the USB port: Hit WindowsKey-X, select Device Manager, plug in the device and observe what's listed under Ports (COM & LPT) - the one that just appeared has the port in brackets (COMn).
Then in platformio.ini in your PlatformIo initialised project folder, you specify the port as a line under the platform section (env: square brackets line): upload_port = com9 or whatever you got from Device Manager.
I hope this helps.

Related

Is there a library for MSR605X that works with Raspberry Pi?

I have been trying to locate a working library for the MSR605X magnetic card reader/writer. At time of writing, I have tried five separate libraries. Only two of these were explicitly for the 605X the other three were for the older 605. All the libraries I have tried either did nothing at all or errored before completing a command (can't figure out the errors either).
I am running Raspberry Pi OS 32 bit on a Raspberry Pi 3 B+ the MSR605X communicates via a USB connection.
So far the library that seems to be most complete is: https://pypi.org/project/msrx/
However, I can not get this library to read or write (either nothing happens or I get a Serial exception "cannot reconfig port).
Any help or links to documentation for this reader is welcome.
EDIT: Adding the commands ran with the above library
msrx -D /dev/input/event4 read
msrx -D /dev/input/jso0 read
The -D is to specify the device path (default is /dev/ttyUSB0 which doesn't exist on my system). I obtained the above two paths by searching for USB serial devices then matching the search result to the device ID which I obtained from lsusb.
Running these commands results in a serial exception (could not reconfig port) which I assume means that I have the wrong device path. I have also checked for any tty* device paths that are changed when I plug in the reader. I consistently get a permission denied error whenever trying to run the above commands with a tty* device path (I am root on this system).
msrx author here — MSR605 requires an external 9V power injected into its cable (via the barrel jack port), otherwise it won't power up properly.

Mount any USB key plug on a port usb in the same folder

I'm currently working on a embedded application on a raspberry pi 3 with Raspbian Jessie. The purpose of this applicatin is to write data in an excel on any usb key (which is always plug on the same port on the raspberry pi)
Current State
Currently, the path where i want the data is directly written in my code
USBadress='/media/pi/DATA3'
Problem
If the usb key is mounted elsewhere or if i'm using a different USB key my application doesn't work
What I tried
Modify the fstab to automaticlly mount /dev/sda1 on a specified folder (ex : media/pi/genericFolder but sometimes the usb key path is different (/dev/sdb1) and this solution only seems to work if you turn on your pi with your usb key already plug (which will be not be true everytime in my case)
I also tried with the UUID but this solution can't work cause my goal is to have a generic solution working with any usb key i plug in this specific usb port
I also saw some solutions with a rule specified on udev but I didn't understand very well...
Thank you in advance !!
Finally found a solution with the following line :
myPath=str(os.popen("mount | grep /media/pi").readlines())
MyPath=MyPath.split(" ")[2]

Raspberry webserver change website name

In my browser i can type 192.168.178.33:8000 to access the webpages on my raspberry or
http://raspberrypi:8000/
Somewhere must be set that the web browser translate http://raspberrypi:8000/ into 192.168.178.33:8000 I tried to find a nameserver but I've no idea what or where I can change this
Is there a simple way to change
http://raspberrypi:8000/ into http://whateverIWantHere:8000/
You can edit your hosts file. The location is different for each OS and may also be different for different versions of the OS. Note that you only need to do the changes on the computer where you want to translate it.
Windows 10:
C:\Windows\System32\Drivers\etc\hosts
Linux/Raspbian:
/etc/hosts
Add the following line to the end of the file:
192.168.178.33 raspberrypi
You may have to restart, I'm not sure if the changes will apply immediately. And you can now type 192.168.178.33:8080 in your browser.

OpenOCD debugging multiple devices at once

I am trying to debug multiple devices at once with openocd on eclipse. I have 2x STM32F303 discovery borards, I have set the hla_serial flag to a proper board, but still no luck.
Separate boards are doing ok, but when trying to debug it's Eclipse saying it'came to error in last sequence.
So if anyone had experience with that. Thanks
We can use hla_serial option within openocd 0.9+ ONLY. I'd recommend to download from
GNU ARM Eclipse project or compile yourself.
To obtain hla_serial, the easiest way found after reading the patch that included this option (http://openocd.zylin.com/#/c/2198/), more specific function "string_descriptor_equal", was to provide a wrong serial, so it would print the correct one.
The command below will create file log_with_correct_serial.txt. Switch board config file for the one currently being used.
openocd.exe -d3 -f board/stm32f4discovery.cfg -c "hla_serial wrong_serial" 2>log_with_correct_serial.txt
Opening log_with_correct_serial.txt you will find correct serial in line containing something like
Debug: 229 23 libusb1_common.c:67 string_descriptor_equal(): Device serial number 'xxxxxxxxxxx' doesn't match requested serial 'wrong_serial'
So create a derived config (for example stm32f4discovery-mydevice1.cfg, assuming stm32f4discovery is used) inside folder board on openocd root directory. Use something like Notepad++ to copy serial as it is hex numbers.
# This is an STM32F4 discovery board with a single STM32F407VGT6 chip.
# http://www.st.com/internet/evalboard/product/252419.jsp
# hla_serial thanks to http://wunderkis.de/stlink-serialno/index.html
source [find board/stm32f4discovery.cfg]
hla_serial V?nIpSU)?
Now to open your device you can use the command below to start debugging using ST-Link adapter.
openocd.exe -f board/stm32f4discovery-mydevice1.cfg
In each eclipse project provides a different board config for each project and you are good to go.

How to configure a new network interface in Android

I am trying to configure a new network interface on Android tablet (v3.2).
From terminal application I can
"ifconfig eth0 192.168.11.14 netmask 255.255.255.0 up"
and everything works fine (ethernet cable is connected trough USB-Ethernet dongle)
I want to make this configuration persistent, but it looks like there is no 'interfaces' file in Android.
Where is network configuration file located? Do I need to create new one? Where?
Thanks,
yet another late answer... scoured the internet and couldn't find any decent answer until I checked out /etc/init.sh ...
I'm using an Android Oreo vmware image for testing purposes and here are the steps that I used to add static IP to Android on boot:
Open Terminal Emulator (if not present install from Play Store)
type su
type vi /etc/init.sh
type i
look for function do_init()
before the closing curly brace (}), type post_init_network
create new line after the closing curly brace (}), type
function post_init_network()
{
ifconfig 192.168.63.122/24 up
}
change the ip and subnet as needed...
press :wq! to save and exit vi
power of and power on Android.
To check Static IP:
open Terminal Emulator again after power on, type su, then type ifconfig
NOTE: I encounter this issue where I can't get an IP from NAT network using 2 interfaces where the first interface is set to static IP and the other DHCP, just power on and power off Android until you can get an internet connection.
Sorry for the really late answer. This is more for future reference.
If your ROM supports init.d scripts, try writing one for this. Put the file in /system/etc/init.d/, change its access mode and owner/group to 0755 and root:root, respectively.
Your command will be run at every boot, effectively making it persistent.