Osd3358
OSD3358 Linux setup
### Click board ####
## Wi-Fi
# Flash on Linux host
# Build esp-open-sdk
git clone https://github.com/pfalcon/esp-open-sdk
sudo apt-get install make unrar-free autoconf automake libtool gcc g++ gperf \
flex bison texinfo gawk ncurses-dev libexpat-dev python-dev python python-serial \
sed git unzip bash help2man wget bzip2
sudo apt-get install libtool-bin
cd esp-open-sdk
make
export PATH="/home/ton/projects/esp/esp-open-sdk/xtensa-lx106-elf/bin:$PATH"
# Build slip router
cd ..
git clone https://github.com/martin-ger/esp_slip_router
cd esp_slip_router
make
make flash
# Flash on target board
sudo apt-get install python-pip
pip install esptool
pip install pyserial
copy 0x00000.bin and 0x10000.bin to linux board
sudo find / -name esptool.py
sudo esptool.py --port /dev/ttyS0 write_flash -fs 4MB 0x00000 firmware/0x00000.bin 0x10000 firmware/0x10000.bin
# Create access point
sudo slattach -L -p slip -s 115200 /dev/ttyS0&
sudo ifconfig sl0 192.168.240.2 pointopoint 192.168.240.1 up mtu 1500
sudo route add -net 192.168.4.0/24 gw 192.168.240.1
telnet 192.168.240.1 7777
CMD>set ap_ssid ESD8266
CMD>set ap_password temppwd
CMD>set use_ap 1
CMD>save
CMD>reset
# Check interface
ip a
# Connect to ESD8266 access point from other device and SSH in
ssh debian@192.168.240.2
## Accelerometer
Error [-9] : Configuration load error. It occurs when failure observed while loading the configuration into the sensor
## GPS
sudo apt-get install gpsd gpsd-clients
sudo cat /dev/ttyS0
sudo systemctl stop gpsd.socket
sudo systemctl disable gpsd.socket
sudo gpsd /dev/ttyS0 -F /var/run/gpsd.sock
# Check output
sudo gpsmon
sudo cgps -s
# Permission error
```
Oct 22 14:36:12 arm gpsd[1329]: gpsd:ERROR: SER: device open of /dev/ttyS0 failed: Permission denied - retrying read-only
Oct 22 14:36:12 arm gpsd[1329]: gpsd:ERROR: SER: read-only device open of /dev/ttyS0 failed: Permission denied
Oct 22 14:36:12 arm gpsd[1329]: gpsd:ERROR: /dev/ttyS0: device activation failed.
Oct 22 14:36:12 arm gpsd[1329]: gpsd:ERROR: /dev/ttyS0: activation failed, freeing device
```
# Permission error fixed
kill gpsd
sudo usermod -a -G dialout gpsd
sudo usermod -a -G tty gpsd
sudo chmod a+rw /dev/ttyS0
sudo chown root:dialout /dev/ttyS0
####
Expose Service to public ports and localhost
vim /lib/systemd/system/gpsd.socket
Change 127.0.0.1 to 0.0.0.0
####
sudo rm /var/run/gpsd.sock
sudo gpsd /dev/ttyS1 -F /var/run/gpsd.sock
# Works:
sudo mv /dev/ttyS0 /dev/ttyS1
sudo chmod 666 /dev/ttyS1
# Link:
https://maker.pro/raspberry-pi/tutorial/how-to-use-a-gps-receiver-with-raspberry-pi-4
## Thermo 14
# Links
https://zoomadmin.com/HowToInstall/UbuntuPackage/python-setuptools
https://wiki.analog.com/resources/tools-software/linux-software/libiio#building_on_the_linux_host_target
https://stackoverflow.com/questions/48565894/using-the-iio-python-package
https://github.com/STMicroelectronics/STMems_Standard_C_drivers/blob/master/stts22h_STdC/driver/stts22h_reg.c
https://ez.analog.com/linux-software-drivers/f/q-a/87080/bitbake-recipe-for-libiio
https://ez.analog.com/linux-software-drivers/f/q-a/97791/cross-compiling-libiio-for-beaglebone
https://github.com/stm32duino/STTS22H
https://www.st.com/resource/en/datasheet/stts22h.pdf
https://github.com/BoschSensortec/BMI270-Sensor-API
# Install libiio
sudo apt-get install libxml2 libxml2-dev bison flex libcdk5-dev cmake
sudo apt-get install libaio-dev libusb-1.0-0-dev libserialport-dev libxml2-dev libavahi-client-dev doxygen graphviz
git clone https://github.com/pcercuei/libini.git
cd libini
mkdir build && cd build && cmake ../ && make && sudo make install
git clone https://github.com/analogdevicesinc/libiio.git
cd libiio/
cmake ./
make all
sudo make install
# Install libiio python bindings
cd libiio/bindings/python
sudo apt-get install python3-setuptools
python3 setup.py.cmakein install
finally create a python file and test import iio
### Device tree ###
sudo apt-get install device-tree-compiler
git clone https://github.com/RobertCNelson/dtb-rebuilder.git
cd dtb-rebuilder
make
git clone https://github.com/octavosystems/OSD335x-Device-Tree/tree/v4.9-2
modify OSD3358-SM-RED/osd3358-bsm-refdesign.dts
copy osd3358-bsm-refdesign.dts to board dtb-rebuilder/src/arm
copy osd335x-sm.dtsi to board dtb-rebuilder/src/arm
# Build all
make
# Build one
make src/arm/osd3358-bsm-refdesign.dts
copy dtb-rebuilder/src/arm/osd3358-bsm-refdesign.dtb /boot/dtbs/<kernel version>/
# Decompile device tree .dtb
dtc -I dtb -O dts -o osd3358-bsm-refdesign.dts osd3358-bsm-refdesign.dtb
# See ipconfig
ip a
# Set tty permissions
chmod o+rw /dev/ttyS0
# Write to Click board header UART:
echo -ne '\033[2J' > /dev/ttyS0
echo -ne "AT\r" > /dev/ttyS0
### I2C ###
# List i2c devices
/usr/sbin/i2cdetect -l
# Probe i2c devices
/usr/sbin/i2cdetect -r 0
### Minicom ###
# Minicom enable carriage return new lines
Ctrl + A -> U
# Minicom quit
Ctrl + A -> X -> Yes
# Minicom enable echo
Ctrl + A -> E
# Minicom clear screen
Ctrl + A -> C
# ELS61 docs
https://m2m.dk/wp-content/uploads/2019/12/ELS61-E-AT-Command-Set-V02.000-15.08.2018.pdf
# Linux connection guide
https://developer.gemalto.com/sites/default/files/ELS61%20Connection%20guide.pdf
### Setup mobile interface ###
1. Connect USB host -> Click board USB client with a USB cable
2. sudo minicom -o -D /dev/ttyACM1 -b 115200
3. AT+CGDCONT=1,"IP","internet"
4. AT^SWWAN=1,1
5. Exit with Ctrl + A -> X -> Yes
6. sudo ping google.com
7. ip a
### LTE Click board ###
# Connect with USB ( Windows )
Putty -> ComX -> Baud 9600
# Connect with UART
sudo minicom -o -D /dev/ttyS0 -b 115200
# Conn
### At commands ###
# Turn on extended errors
AT+CMEE=2
# Misc
AT+COPS=2
AT+COPS=0
AT+CGATT=0
AT+CGATT=1
AT+CFUN=1,1
AT^SWWAN=1,3
AT+CEER=0
AT+CGDCONT?
AT+CGDCONT=1
AT+CGDCONT=3
Recommendations for LTE attachWhen using LTE auto attach, the application shall ensure that the correct APN is specified for <cid> 1 beforethe ME attaches to LTE. To do so, use the command AT+CGDCONT=1,<PDP_type>,<APN>. If the application cannot ensure that the correct APN is configured for <cid> 1 before the ME attempts to attach to LTE, the application shall set the correct APN with AT+CGDCONT, and then employ one of the following com-mand sequences: •AT+COPS=2 and AT+COPS=0 to deregister from the network and force a new network registration, thus enabling a new LTE auto attach attempt. If running, the T3402 timer will be stopped by AT+COPS=0. •AT+CGATT=0 and AT+CGATT=1 to manually trigger a detach and re-attach attempt. If running, the T3402 timer will be stopped by AT+CGATT=0. •AT+CFUN=1,1 to restart the ME (since the AT+CGDCONT setting is non-volatile).
AT+CEER
AT+CGDCONT=0,"IP","internet"
AT+CGDCONT=1,"IP","internet"
AT+CGDCONT=3,"IP","internet"
AT^SWWAN=1,0
AT^SWWAN=1,1
AT^SWWAN=1,3
AT+COPS=1,1,"Elisa",7
at+cpin="0000"
AT+CEER=0