Overview
STM32F107 RBT6 + QCA8337 AL3C based router with serial and swd headers
Mainstream Connectivity line, ARM Cortex-M3 MCU with 128 Kbytes Flash, 72 MHz CPU, Ethernet MAC, CAN and USB 2.0 OTG
Firmware
According to https://wiki.mikrotik.com/wiki/SwOS/RB250_RB260#Summary
new RB260GS (CSS106-5G-1S), new RB260GSP(CSS106-1G-4P-1S) supports SwOS v2.0 and newer.
Example working (as of 2018-07-06) url download links which work for CSS106-5G-1S:
https://download2.mikrotik.com/swos2/css106/swos-css1061g4p1s-2.0.bin
https://download2.mikrotik.com/swos2/css106/swos-css1061g4p1s-2.2.bin
dpavlin@lib10:/lib10/arh-hw/backup/Mikrotik-RB260GS-CSS106-5G-1S/rb260gsp$ md5sum *
bf110ca7e1cd0558cefeacd9e0b62c19 swos-css1061g4p1s-2.0.bin
a491bbf2732937839e6a8222a876cc7a swos-css1061g4p1s-2.2.bin
f098106dfc8ac5ad0fedf0181c68d8de swos-css1061g4p1s-2.3.bin
f4f74f697039a83baa99d37017251805 swos-css1061g4p1s-2.4.bin
90d2ec8571dd9d9aeab1bfbaaa99dea2 swos-css1061g4p1s-2.5.bin
a7f046fc8a12b5ebeb85f9a4bb0dd275 swos-css1061g4p1s-2.6.bin
a1e7adc6ad63e5560156b0f2b6f272ce swos-css1061g4p1s-2.7.bin
https://mikrotik.com/download (SwitchOS) latest version:
https://download.mikrotik.com/swos2/css106/swos-css106-2.13.bin
version
from web interface
Firmware
Current Installed Version 2.7 (built at Fri Dec 15 2017 09:42:48 GMT+0100 (CET))
Latest Available Version 2.7 (built at Fri Dec 15 2017 09:42:48 GMT+0100 (CET))
reset
SwOS v2.x - RB260GS(CSS106-5G-1S) and RB260GSP(CSS106-1G-4P-1S)
The new RB260GS(CSS106-5G-1S) and RB260GSP(CSS106-1G-4P-1S) has built-in backup SwOS firmware which can be loaded in case standard firmware breaks or upgrade fails:
Holding Reset button for few seconds while device is booting resets configuration and loads backup firmware SwOS 2.0p.
After loading backup firmware SwOS 2.0p it is possible to connect to 192.168.88.1 using web browser and install new SwOS firmware.
default ip: 192.168.88.1
Current Installed Version 2.0p (built at Fri Oct 21 2016 10:18:39 GMT+0200 (CEST))
Latest Available Version 2.7 (built at Fri Dec 15 2017 09:42:48 GMT+0100 (CET))
After this, router knows that there is new version, but can't download it from http://upgrade.mikrotik.com/swos2/css106/swos-css106-2.7.bin
Linux setup
dpavlin@x230:~$ sudo ifconfig enp0s25 192.168.88.240
wget --http-user=admin --http-password='' 'http://192.168.88.1/!stats.b'
find on network
https://forum.mikrotik.com/viewtopic.php?t=162881
https://wiki.mikrotik.com/wiki/MAC_access
MNDP frames
sudo apt install mactelnet-client
dpavlin@klin:~$ mndp
Searching for MikroTik routers... Abort with CTRL+C.
IP MAC-Address Identity (platform version hardware) uptime
192.168.88.1 c4:ad:34:47:12:91 MikroTik (MikroTik 2.7 CSS106-5G-1S) up 113 days 4 hours
10.60.0.1 d4:ca:6d:1:4c:ed ccr (MikroTik 6.46.6 (testing) CCR1036-8G-2S+) up 113 days 4 hours XYIT-4UTW bridge60/sfp2-60
Updated by Dobrica Pavlinušić on Mar 8 2:10am
Posted by Dobrica Pavlinušić on Jul 5 9:04am
https://gregdavill.github.io/OrangeCrab/
https://github.com/gregdavill/OrangeCrab
[Mon Sep 14 13:46:12 2020] usb 2-2.3: new full-speed USB device number 8 using xhci_hcd
[Mon Sep 14 13:46:12 2020] usb 2-2.3: New USB device found, idVendor=1209, idProduct=5af0, bcdDevice= 1.01
[Mon Sep 14 13:46:12 2020] usb 2-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[Mon Sep 14 13:46:12 2020] usb 2-2.3: Product: OrangeCrab r0.2 DFU Bootloader v3.1
[Mon Sep 14 13:46:12 2020] usb 2-2.3: Manufacturer: GsD
Microwatt with Linux on OrangeCrab
https://codeconstruct.com.au/docs/microwatt-orangecrab/
⦗OSS CAD Suite⦘ dpavlin@klin:/klin/FPGA/microwatt$ make microwatt.bit 2>&1 | tee ~/tmp/build1.txt
Updated by Dobrica Pavlinušić on Jan 24 3:37am
Posted by Dobrica Pavlinušić on Sep 14 4:48am
http://www.kinetic.co.uk/TrilbyAbout.php
There is https site, but it has broken css
KINETIC AVIONICS
TRILBY Rev.2.23 2015
Contents: [Dobrica Pavlinušić's random unstructured stuff]
|
components
from schematic Trilby2V23PUBLIC.pdf
ADG918
https://www.analog.com/en/products/adg918.html
Wideband, 43 dB Isolation at 1 GHz, CMOS 1.65 V to 2.75 V, 2:1 Mux/SPDT Switches
TDA18219HN
https://www.nxp.com/part/TDA18219HN#/
Silicon tuner for terrestrial and cable digital TV reception
LTC2226CUH
https://eu.mouser.com/ProductDetail/Analog-Devices/LTC2226CUH
Analog to Digital Converters - ADC LTC2226 - 12-Bit, 25Msps Low Power 3V ADC
LFE5U-85F-BG381
jumpers
J456, 1-2 IS PI 5V AND 2-3 IS USB 5V
J451 - JTAG SELECT - REMOVE LINK FOR USB
J450 - JTAG SELECT - REMOVE LINK WHEN USING LATTICE CABLE
J30 - CFG_0 - by default pull up, jumper pulls them down
J31 - CFG_1
J32 - CFG_2
J33 - PROGRAMN - reprogram FPGA
J29
1 3V3
2 TDI
3 TMS
4 TCK
5 TDO
6 GND
J26 - INSTALL TO ENABLE EEPROM WRITING
TP18 GND
TP19 GND
J458 - GPIO
from /nuc/rpi/trilby/Trilby_v_1_03_project/impl1/trilby_test_impl1.pad
rpi setup
enable spi, i2c in raspi-config
pi@trilby:~/linux-gpio-pinout $ i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- 44 -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
44 - example i2c device in fpga
68 - rtc
rtc
root@trilby:/home/pi# echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
root@trilby:/home/pi#
[Fri Dec 24 15:02:31 2021] i2c i2c-1: new_device: Instantiated device ds1307 at 0x68
[Fri Dec 24 15:02:31 2021] rtc-ds1307 1-0068: registered as rtc0
[Fri Dec 24 15:02:31 2021] rtc-ds1307 1-0068: setting system clock to 2000-01-01T02:29:49 UTC (946693789)
root@trilby:/home/pi# hwclock -r
2021-12-24 15:02:37.028752+00:00
openocd
pi@trilby:~/openocd-rpi2-stm32 $ grep -v '^#' trilby.cfg
adapter driver bcm2835gpio
bcm2835gpio_peripheral_base 0x3F000000
bcm2835gpio_speed_coeffs 146203 36
bcm2835gpio_jtag_nums 23 27 22 24
adapter speed 50
transport select jtag
pi@trilby:~/openocd-rpi2-stm32 $ openocd -f trilby.cfg
Open On-Chip Debugger 0.11.0-rc2
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
jtag
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : BCM2835 GPIO JTAG/SWD bitbang driver
Info : clock speed 50 kHz
Warn : There are no enabled taps. AUTO PROBING MIGHT NOT WORK!!
Info : JTAG tap: auto0.tap tap/device found: 0x41112043 (mfg: 0x021 (Lattice Semi.), part: 0x1112, ver: 0x4)
Warn : AUTO auto0.tap - use "jtag newtap auto0 tap -irlen 2 -expected-id 0x41112043"
Error: IR capture error at bit 2, saw 0x3fffffffffffff05 not 0x...3
Warn : Bypassing JTAG setup events due to errors
Warn : gdb services need one or more targets defined
Updated by Dobrica Pavlinušić on Dec 31 8:35am
Posted by Dobrica Pavlinušić on Dec 24 2:56am
Contents: [Dobrica Pavlinušić's random unstructured stuff]
|
video
git
dpavlin@klin:/klin/FPGA/CFU-Playground$ git remote -v
origin https://github.com/google/CFU-Playground.git (fetch)
origin https://github.com/google/CFU-Playground.git (push)
dpavlin@klin:/klin/FPGA/CFU-Playground$ git submodule init
dpavlin@klin:/klin/FPGA/CFU-Playground$ git submodule update
ulx3s board
https://github.com/litex-hub/litex-boards/blob/master/litex_boards/targets/radiona_ulx3s.py
dpavlin@klin:/klin/FPGA/CFU-Playground$ find . -name radiona_ulx3s.py
./third_party/python/litex_boards/litex_boards/targets/radiona_ulx3s.py
./third_party/python/litex_boards/litex_boards/platforms/radiona_ulx3s.py
# edit fpga settings here
dpavlin@klin:/klin/FPGA/CFU-Playground$ vi ./third_party/python/litex_boards/litex_boards/targets/radiona_ulx3s.py
modifications for 85F litex-85f.diff
build
you really need riscv64 toolchain from https://github.com/sifive/freedom-tools/releases/tag/v2020.04.0-Toolchain.Only
dpavlin@klin:/klin/FPGA/CFU-Playground/proj$ cat build.sh
#!/bin/sh -xe
echo https://github.com/google/CFU-Playground
export PATH=/opt/riscv64-unknown-elf-gcc-8.3.0-2020.04.1-x86_64-linux-ubuntu14/bin/:$PATH
export TARGET=radiona_ulx3s
export UART_SPEED=115200
time make prog load
sumulation
dpavlin@klin:/klin/FPGA/CFU-Playground/proj/avg_pdti8$ time make PLATFORM=sim load -j 4
boot over serial using network
host with ulx3s connected
root@pihdmi:/home/pi# socat /dev/ttyUSB0,b115200,raw,echo=0 TCP:10.60.0.92:2003
machine running litex
dpavlin@klin:/klin/FPGA/CFU-Playground/proj/hps_accel$ socat TCP-LISTEN:2003 PTY,link=ttyV2,raw
- re-run terminal with new virtal ttyV2
dpavlin@klin:/klin/FPGA/CFU-Playground/proj/hps_accel$ /klin/FPGA/CFU-Playground/soc/bin/litex_term --speed 115200 --serial-boot --kernel /klin/FPGA/CFU-Playground/proj/hps_accel/build/software.bin ttyV2
litex> serialboot
Booting from serial...
Press Q or ESC to abort boot completely.
sL5DdSMmkekro
[LXTERM] Received firmware download request from the device.
[LXTERM] Uploading /klin/FPGA/CFU-Playground/proj/hps_accel/build/software.bin to 0x40000000 (1313688 bytes)...
[LXTERM] Upload complete (9.9KB/s).
[LXTERM] Booting the device.
[LXTERM] Done.
Executing booted program at 0x40000000
--============= Liftoff! ===============--
Hello, World!
Updated by Dobrica Pavlinušić on Dec 3 12:24pm
Posted by Dobrica Pavlinušić on Jul 21 11:52am
https://tasmota.github.io/docs/devices/Sonoff-T1/
Configuration > Configure Module > Sonoff T1 3CH
immediately after flashing Tasmota (so it won't reset when powered from adapter):
SetOption13 1
mapping: https://github.com/arendst/Tasmota/blob/a466c5abf33386c3dda34696e11ae975c7ac6649/tasmota/tasmota_template.h#L2468
{ // SONOFF_T13 - Sonoff T1 3CH (ESP8285)
GPI8_KEY1, // GPIO00 Button 1
GPI8_USER, // GPIO01 Serial RXD and Optional sensor
GPI8_USER, // GPIO02 Optional Sensor (J3 Pin 5)
GPI8_USER, // GPIO03 Serial TXD and Optional sensor
GPI8_REL3, // GPIO04 Blue Led and Relay 3 (0 = Off, 1 = On)
GPI8_REL2, // GPIO05 Blue Led and Relay 2 (0 = Off, 1 = On)
// GPIO06 (SD_CLK Flash)
// GPIO07 (SD_DATA0 Flash QIO/DIO/DOUT)
// GPIO08 (SD_DATA1 Flash QIO/DIO/DOUT)
GPI8_KEY2, // GPIO09 Button 2
GPI8_KEY3, // GPIO10 Button 3
// GPIO11 (SD_CMD Flash)
GPI8_REL1, // GPIO12 Blue Led and Relay 1 (0 = Off, 1 = On)
GPI8_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off) - Link and Power status
0, 0, 0, 0
},
Updated by Dobrica Pavlinušić on Oct 31 4:38am
Posted by Dobrica Pavlinušić on Oct 31 3:59am
https://templates.blakadder.com/gosund_SP112_v3_4.html
GPIO # Component
GPIO00 Led1i
GPIO01 None
GPIO02 Led2i
GPIO03 None
GPIO04 HLWBL CF1
GPIO05 BL0937 CF
GPIO09 None
GPIO10 None
GPIO12 HLWBL SELi
GPIO13 Relay2i
GPIO14 Relay1
GPIO15 None
GPIO16 None
FLAG Button
{"NAME":"Gosund 112v3.4","GPIO":[56,0,57,0,132,134,0,0,131,30,21,0,0],"FLAG":4,"BASE":18}
after entering into interface following config is enabled:
{"NAME":"Gosund 112v3.4","GPIO":[320,0,321,0,2656,2720,0,0,2624,257,224,0,0,4800],"FLAG":0,"BASE":18}
Updated by Dobrica Pavlinušić on Sep 1 6:54am
Posted by Dobrica Pavlinušić on Aug 12 4:30am
https://docs.ai-thinker.com/en/esp32c3
ESP32-C3_Kit
3528
ESP-C3-32S
Contents: [Dobrica Pavlinušić's random unstructured stuff]
|
chip_id
dpavlin@nuc:/nuc/esp32/esp-idf/examples$ /nuc/esp32/esptool/esptool.py --port /dev/ttyUSB4 chip_id
esptool.py v3.2-dev
Serial port /dev/ttyUSB4
Connecting....
Detecting chip type... ESP32-C3
Chip is ESP32-C3 (revision 3)
Features: Wi-Fi
Crystal is 40MHz
MAC: 7c:df:a1:b6:b4:94
Uploading stub...
Running stub...
Stub running...
Warning: ESP32-C3 has no Chip ID. Reading MAC instead.
MAC: 7c:df:a1:b6:b4:94
Hard resetting via RTS pin...
flash_id
dpavlin@nuc:/nuc/esp32/esp-idf/examples$ /nuc/esp32/esptool/esptool.py --port /dev/ttyUSB4 flash_id
esptool.py v3.2-dev
Serial port /dev/ttyUSB4
Connecting....
Detecting chip type... ESP32-C3
Chip is ESP32-C3 (revision 3)
Features: Wi-Fi
Crystal is 40MHz
MAC: 7c:df:a1:b6:b4:94
Uploading stub...
Running stub...
Stub running...
Manufacturer: 5e
Device: 6015
Detected flash size: 2MB
Hard resetting via RTS pin...
module info
https://docs.ai-thinker.com/_media/esp32/docs/esp-c3-32s-kit-v1.0_specification.pdf
Wiring of onboard lights
IO5 is connected to RGB blue lamp beads; IO3 is connected to
RGB red lamp beads; IO4 is connected to RGB green lamp
beads; IO19 is connected to cool color lamp beads; IO18 is
connected to warm color lamp beads;(high level is valid)
Updated by Dobrica Pavlinušić on Aug 22 3:09am
Posted by Dobrica Pavlinušić on Aug 22 2:47am
CH341A mini flash programmer
Contents: [Dobrica Pavlinušić's random unstructured stuff]
|

This is 5V device without modification! It works for me(tm) but you have been warned
http://www.eevblog.com/forum/repair/ch341a-serial-memory-programmer-power-supply-fix/
Just lift pin 28 and put some tape under it to prevent any short circuit. Then solder one wire from this pin to pin 2 of AMS1117 and also to C4. The side of the C4 to connect is the one connected to CH341A pin 9.
CHM341A-3V3-fix.jpgjumper on pins
1-2 SPI flash programmer mode
2-3 TTL serial mode
supported out-of-box by flashrom, probably better option, but anyway:
https://github.com/setarcos/ch341prog
dpavlin@nuc:/nuc/ch341a$ git clone https://github.com/setarcos/ch341prog
Cloning into 'ch341prog'...
remote: Counting objects: 104, done.
remote: Total 104 (delta 0), reused 0 (delta 0), pack-reused 104
Receiving objects: 100% (104/104), 34.79 KiB | 0 bytes/s, done.
Resolving deltas: 100% (61/61), done.
Checking connectivity... done.
dpavlin@nuc:/nuc/ch341a$ cd ch341prog/
dpavlin@nuc:/nuc/ch341a/ch341prog$ make
gcc -std=gnu99 -Wall ch341a.c main.c -o ch341prog -lusb-1.0
dpavlin@nuc:/nuc/ch341a/ch341prog$ ./ch341prog
Usage:
-h, --help display this message
-i, --info read the chip ID info
-e, --erase erase the entire chip
-l, --length <bytes> manually set length
-w, --write <filename> write chip with data from filename
-r, --read <filename> read chip and save data to filename
-t, --turbo increase the i2c bus speed (-tt to use much faster speed)
-d, --double double the spi bus speed
I2C in userspace
https://sourceforge.net/projects/ch341eepromtool/
dpavlin@nuc:/nuc/ch341a/ch341eepromtool_0.5$ gcc -o ch341eeprom ch341eeprom.c ch341funcs.c -lusb-1.0
dpavlin@nuc:/nuc/ch341a/ch341eepromtool_0.5$
dpavlin@nuc:/nuc/ch341a/ch341eepromtool_0.5$ ./ch341eeprom
ch341eeprom - an i2c EEPROM programming tool for the WCH CH341a IC
Version 0.5 copyright (c) 2011 asbokid <ballymunboy@gmail.com>
This program comes with asbolutely no warranty; This is free software,
and you are welcome to redistribute it under certain conditions:
GNU GPL v3 License: http://www.gnu.org/licenses/gpl.html
Usage:
-h, --help display this text
-v, --verbose verbose output
-d, --debug debug output
-s, --size size of EEPROM {24c32|24c64}
-e, --erase erase EEPROM (fill with 0xff)
-w, --write <filename> write EEPROM with image from filename
-r, --read <filename> read EEPROM and save image to filename
Example: ch341eeprom -v -s 24c64 -w bootrom.bin
flashrom SPI
Not needed anymore, included in mainline flashrom
git clone https://github.com/urjaman/flashrom/
git checkout -b origin/ch341a origin/ch341a
dpavlin@nuc:/nuc/flashrom$ sudo apt-get install pciutils-dev
linux kernel spi module
dpavlin@nuc:/nuc$ git clone https://github.com/gschorcht/spi-ch341-usb.git
Cloning into 'spi-ch341-usb'...
remote: Counting objects: 63, done.
remote: Total 63 (delta 0), reused 0 (delta 0), pack-reused 63
Unpacking objects: 100% (63/63), done.
dpavlin@nuc:/nuc$ cd spi-ch341-usb
dpavlin@nuc:/nuc/spi-ch341-usb$ make
make -C /usr/src/linux-headers-4.14.0-3-amd64/ M=/nuc/spi-ch341-usb modules
make[1]: Entering directory '/usr/src/linux-headers-4.14.0-3-amd64'
CC [M] /nuc/spi-ch341-usb/spi-ch341-usb.o
Building modules, stage 2.
MODPOST 1 modules
CC /nuc/spi-ch341-usb/spi-ch341-usb.mod.o
LD [M] /nuc/spi-ch341-usb/spi-ch341-usb.ko
make[1]: Leaving directory '/usr/src/linux-headers-4.14.0-3-amd64'
dpavlin@nuc:/nuc/spi-ch341-usb$
dpavlin@nuc:/nuc/spi-ch341-usb$ sudo make install
[sudo] password for dpavlin:
dpavlin@nuc:/nuc/spi-ch341-usb$ sudo modprobe spi-ch341-usb
[525021.048281] spi-ch341-usb 2-2.1.4:1.0: ch341_cfg_probe: output cs0 SPI slave with cs=0
[525021.048285] spi-ch341-usb 2-2.1.4:1.0: ch341_cfg_probe: output cs1 SPI slave with cs=1
[525021.048287] spi-ch341-usb 2-2.1.4:1.0: ch341_cfg_probe: output cs2 SPI slave with cs=2
[525021.048290] spi-ch341-usb 2-2.1.4:1.0: ch341_cfg_probe: input gpio4 gpio=0 irq=0 (hwirq)
[525021.048292] spi-ch341-usb 2-2.1.4:1.0: ch341_cfg_probe: input gpio5 gpio=1 irq=1
[525021.048296] spi-ch341-usb 2-2.1.4:1.0: ch341_spi_probe: SPI master connected to SPI bus 0
[525021.048426] spi-ch341-usb 2-2.1.4:1.0: ch341_spi_probe: SPI device /dev/spidev0.0 created
[525021.048516] spi-ch341-usb 2-2.1.4:1.0: ch341_spi_probe: SPI device /dev/spidev0.1 created
[525021.048596] spi-ch341-usb 2-2.1.4:1.0: ch341_spi_probe: SPI device /dev/spidev0.2 created
[525021.049147] spi-ch341-usb 2-2.1.4:1.0: ch341_usb_probe: connected
[525021.049194] usbcore: registered new interface driver spi-ch341-usb
linux kernel i2c module
root@nuc:/nuc# git clone https://github.com/gschorcht/i2c-ch341-usb.git
Cloning into 'i2c-ch341-usb'...
remote: Counting objects: 39, done.
remote: Total 39 (delta 0), reused 0 (delta 0), pack-reused 39
Unpacking objects: 100% (39/39), done.
root@nuc:/nuc# cd i2c-ch341-usb
root@nuc:/nuc/i2c-ch341-usb# make
make -C /usr/src/linux-headers-4.14.0-3-amd64/ M=/nuc/i2c-ch341-usb modules
make[1]: Entering directory '/usr/src/linux-headers-4.14.0-3-amd64'
CC [M] /nuc/i2c-ch341-usb/i2c-ch341-usb.o
Building modules, stage 2.
MODPOST 1 modules
CC /nuc/i2c-ch341-usb/i2c-ch341-usb.mod.o
LD [M] /nuc/i2c-ch341-usb/i2c-ch341-usb.ko
make[1]: Leaving directory '/usr/src/linux-headers-4.14.0-3-amd64'
root@nuc:/nuc/i2c-ch341-usb#
root@nuc:/nuc/i2c-ch341-usb# sudo make install
root@nuc:/nuc/i2c-ch341-usb# modprobe i2c-ch341-usb
[Wed Feb 7 16:37:00 2018] i2c-ch341-usb 2-2.1.4:1.0: ch341_cfg_probe: output gpio0 gpio=0 irq=0
[Wed Feb 7 16:37:00 2018] i2c-ch341-usb 2-2.1.4:1.0: ch341_cfg_probe: output gpio1 gpio=1 irq=1
[Wed Feb 7 16:37:00 2018] i2c-ch341-usb 2-2.1.4:1.0: ch341_cfg_probe: output gpio2 gpio=2 irq=2
[Wed Feb 7 16:37:00 2018] i2c-ch341-usb 2-2.1.4:1.0: ch341_cfg_probe: output gpio3 gpio=3 irq=3
[Wed Feb 7 16:37:00 2018] i2c-ch341-usb 2-2.1.4:1.0: ch341_cfg_probe: input gpio4 gpio=4 irq=4 (hwirq)
[Wed Feb 7 16:37:00 2018] i2c-ch341-usb 2-2.1.4:1.0: ch341_cfg_probe: input gpio5 gpio=5 irq=5
[Wed Feb 7 16:37:00 2018] i2c-ch341-usb 2-2.1.4:1.0: ch341_cfg_probe: input gpio6 gpio=6 irq=6
[Wed Feb 7 16:37:00 2018] i2c-ch341-usb 2-2.1.4:1.0: ch341_cfg_probe: input gpio7 gpio=7 irq=7
[Wed Feb 7 16:37:00 2018] i2c-ch341-usb 2-2.1.4:1.0: ch341_i2c_probe: created i2c device /dev/i2c-8
[Wed Feb 7 16:37:00 2018] i2c-ch341-usb 2-2.1.4:1.0: ch341_i2c_set_speed: Change i2c bus speed to 100 kbps
[Wed Feb 7 16:37:00 2018] i2c-ch341-usb 2-2.1.4:1.0: ch341_usb_probe: connected
[Wed Feb 7 16:37:00 2018] usbcore: registered new interface driver i2c-ch341-usb
schematics and info
I added soic 8 pinout over zif socket, because position of pin 1 is not obvious (or clearly marked anywhere on top). I suggest that you fix that with silver sharpy.
 alternative schematics
https://github.com/Upcycle-Electronics/CH341A-Pro
ch341Apro_schematicV01.pdf
Updated by Dobrica Pavlinušić on Aug 14 4:18am
Posted by Dobrica Pavlinušić on May 22 1:49pm
Contents: [Dobrica Pavlinušić's random unstructured stuff]
|
OpenDPS
pinout
 upgrade to opensource firmware
https://github.com/kanflo/opendps.git
dpavlin@nuc:/nuc$ git clone --recursive https://github.com/kanflo/opendps.git
dpavlin@nuc:/nuc$ cd opendps/
dpavlin@nuc:/nuc/opendps$ make -C libopencm3
dpavlin@nuc:/nuc/opendps$ make -C opendps
st-link
connecting rst pin to unpowered st-link stops dps5005 from booting
https://johan.kanflo.com/upgrading-your-dps5005/
openocd
pi@pihdmi:~ $ sudo openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg
Open On-Chip Debugger 0.10.0+dev-01489-g06c7a53f1-dirty (2020-11-14-15:21)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
WARNING: interface/stlink-v2.cfg is deprecated, please switch to interface/stlink.cfg
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 1000 kHz
Info : STLINK V2J28S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.273018
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : starting gdb server for stm32f1x.cpu on 3333
Info : Listening on port 3333 for gdb connections
backup few states
from another terminal
pi@pihdmi:/nuc/opendps $ ./ocd-client.py all | tee 5V-off.txt
# exit openocd, turn output on
pi@pihdmi:/nuc/opendps $ ./ocd-client.py all | tee 5V-on.txt
erase
pi@pihdmi:/nuc/opendps $ telnet localhost 4444
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
> reset halt
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080010a4 msp: 0x20001ff0
> flash erase_address unlock 0x08000000 0x10000
device id = 0x10016420
flash size = 64kbytes
erased address 0x08000000 (length 65536) in 0.145284s (440.517 KiB/s)
flash
pi@pihdmi:/nuc/opendps/opendps $ make flash
FLASH opendps_DPS5005.srec
(echo "halt; program /nuc/opendps/opendps/opendps_DPS5005.srec verify reset" | nc -4 localhost 4444 2>/dev/null) || \
openocd -f interface/stlink-v2.cfg \
-f target/stm32f1x.cfg \
-c "program opendps_DPS5005.srec verify reset exit" \
2>/dev/null
��������Open On-Chip Debugger
> halt; program /nuc/opendps/opendps/opendps_DPS5005.srec verify reset
target halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x08000bb8 msp: 0x20001fb8
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080010a4 msp: 0x20001ff0
** Programming Started **
device id = 0x10016420
flash size = 64kbytes
** Programming Finished **
** Verify Started **
** Verified OK **
** Resetting Target **
pi@pihdmi:/nuc/opendps/dpsboot $ make flash
FLASH dpsboot.srec
(echo "halt; program /nuc/opendps/dpsboot/dpsboot.srec verify reset" | nc -4 localhost 4444 2>/dev/null) || \
openocd -f interface/stlink-v2.cfg \
-f target/stm32f1x.cfg \
-c "program dpsboot.srec verify reset exit" \
2>/dev/null
��������Open On-Chip Debugger
> halt; program /nuc/opendps/dpsboot/dpsboot.srec verify reset
target halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x08000bb8 msp: 0x20001fb8
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080010a4 msp: 0x20001ff0
** Programming Started **
** Programming Finished **
** Verify Started **
** Verified OK **
** Resetting Target **
client software
pi@pihdmi:/nuc/opendps $ pip3 install -r requirements.txt
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting crc16==0.1.1 (from -r requirements.txt (line 1))
Downloading https://www.piwheels.org/simple/crc16/crc16-0.1.1-cp37-cp37m-linux_armv7l.whl
Requirement already satisfied: pyserial==3.4 in /usr/lib/python3/dist-packages (from -r requirements.txt (line 2)) (3.4)
Installing collected packages: crc16
Successfully installed crc16-0.1.1
pi@pihdmi:/nuc/opendps $ cd dpsctl/
pi@pihdmi:/nuc/opendps/dpsctl $ python3 ./dpsctl.py --device /dev/ttyUSB2 --ping
Error: timeout talking to device /dev/ttyUSB2.
# swap rx/tx pins
pi@pihdmi:/nuc/opendps/dpsctl $ python3 ./dpsctl.py --device /dev/ttyUSB2 --ping
Got pong from device
pi@pihdmi:/nuc/opendps/dpsctl $ python3 ./dpsctl.py --device /dev/ttyUSB2 --query
Func : cv (on)
voltage : 5000
current : 1000
V_in : 10.77 V
V_out : 5.03 V
I_out : 0.001 A
pi@pihdmi:/nuc/opendps/dpsctl $ python3 ./dpsctl.py --device /dev/ttyUSB2 -o off
pi@pihdmi:/nuc/opendps/dpsctl $ python3 ./dpsctl.py --device /dev/ttyUSB2 --query
Func : cv (off)
voltage : 5000
current : 1000
V_in : 10.78 V
V_out : 1.73 V
I_out : 0.001 A
pi@pihdmi:/nuc/opendps/dpsctl $ python3 ./dpsctl.py --device /dev/ttyUSB2 --query
Func : cv (off)
voltage : 5000
current : 1000
V_in : 10.78 V
V_out : 0.01 V
I_out : 0.000 A
serial upgrade
pi@pihdmi:/nuc/opendps/dpsctl $ python3 dpsctl.py --device /dev/ttyUSB2 -U ../opendps/opendps_DPS5005.bin
Download progress: 2% Error: timeout talking to device /dev/ttyUSB2.
SEL on power-on to stay in bootloader
# it bricked my board first time I tried it
esp8266
I had trouble finding toolchain which works with it, I ended up using https://github.com/pfalcon/esp-open-sdk
dpavlin@nuc:/nuc/esp8266/esp-open-sdk$ git remote -v
origin https://github.com/pfalcon/esp-open-sdk.git (fetch)
origin https://github.com/pfalcon/esp-open-sdk.git (push)
I also needed to replace esptool, since this machine requires python3 version of it
ln -s /nuc/esp32/esptool/esptool.py /nuc/esp8266/esp-open-sdk/xtensa-lx106-elf/bin/esptool.py
wifi config
dpavlin@nuc:/nuc/opendps$ ls -al esp8266-proxy/esp-open-rtos/include/private_ssid_config.h
-rw-r--r-- 1 dpavlin dpavlin 60 Aug 4 10:21 esp8266-proxy/esp-open-rtos/include/private_ssid_config.h
dpavlin@nuc:/nuc/opendps$ vi esp8266-proxy/esp-open-rtos/include/private_ssid_config.h
build
dpavlin@nuc:/nuc/opendps$ cd esp8266-proxy/
dpavlin@nuc:/nuc/opendps/esp8266-proxy$ cat env.sh
export EOR_ROOT=`pwd`/esp-open-rtos
export PATH=/nuc/esp8266/esp-open-sdk/xtensa-lx106-elf/bin:$PATH
dpavlin@nuc:/nuc/opendps/esp8266-proxy$ . env.sh
dpavlin@nuc:/nuc/opendps/esp8266-proxy$ make
Merged 1 ELF section
flash
dpavlin@nuc:/nuc/opendps/esp8266-proxy$ make flash
esptool.py -p /dev/ttyUSB0 --baud 115200 write_flash -fs 16m -fm qio -ff 40m \
0x0 esp-open-rtos/bootloader/firmware_prebuilt/rboot.bin 0x1000 esp-open-rtos/bootloader/firmware_prebuilt/blank_config.bin 0x2000 ./firmware/dpsproxy.bin
WARNING: Flash size arguments in megabits like '16m' are deprecated.
Please use the equivalent size '2MB'.
Megabit arguments may be removed in a future release.
esptool.py v3.2-dev
Serial port /dev/ttyUSB0
pi@pihdmi:/nuc/opendps/esp8266-proxy $ /nuc/esp32/esptool/esptool.py --port /dev/ttyUSB3 write_flash 0x0 esp-open-rtos/bootloader/firmware_prebuilt/rboot.bin 0x1000 esp-open-rtos/bootloader/firmware_prebuilt/blank_config.bin 0x2000 ./firmware/dpsproxy.bin
esptool.py v3.2-dev
Serial port /dev/ttyUSB3
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 5c:cf:7f:c2:6b:19
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00000fff...
Flash will be erased from 0x00001000 to 0x00001fff...
Flash will be erased from 0x00002000 to 0x00043fff...
Compressed 3104 bytes to 2169...
Wrote 3104 bytes (2169 compressed) at 0x00000000 in 0.3 seconds (effective 79.1 kbit/s)...
Hash of data verified.
Compressed 2048 bytes to 23...
Wrote 2048 bytes (23 compressed) at 0x00001000 in 0.1 seconds (effective 132.3 kbit/s)...
Hash of data verified.
Compressed 268660 bytes to 195361...
Wrote 268660 bytes (195361 compressed) at 0x00002000 in 18.0 seconds (effective 119.6 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
test
reset board and verify that it's connecting to wifi
pi@rpi4:/nuc/opendps/dpsctl $ microcom -p /dev/ttyUSB0 -s 9600
connected to /dev/ttyUSB0
Escape character: Ctrl-\
Type the escape character to get to the prompt.
2dnټ�bdbz�$�`dl��x$2�+`b:`:r�pd�zt{�[�8)1J������: sta(4c:11:ae:0d:1f:ab)
add if0
scandone
add 0
aid 16
cnt
connected with dreamhouse, channel 10
dhcp client start...
ip:192.168.3.111,mask:255.255.255.0,gw:192.168.3.1
now test client
pi@rpi4:~ $ /nuc/opendps/dpsctl/dpsctl.py -S
192.168.3.111
^C
pi@rpi4:~ $ export DPSIF=192.168.3.111
pi@rpi4:~ $ /nuc/opendps/dpsctl/dpsctl.py -q
Func : cv (off)
voltage : 5000
current : 1000
V_in : 9.71 V
V_out : 0.00 V
I_out : 0.000 A
powering esp8266
3.3v voltage is available at jtag pins, but it can't supply enough current to run esp8266
There is 5v pin from buck converter on top-left pin of 2x4 pins on left side of board (when looking from back side of module)
5v gnd
o o
o o
o o
o o

power drain from input voltage is roughly doubled when powering esp8266 from 5v rail
Updated by Dobrica Pavlinušić on Aug 9 1:01pm
Posted by Dobrica Pavlinušić on Aug 14 10:46am
The-Generic-STM32F103-Pinout-Diagram.pdf
Contents: [Dobrica Pavlinušić's random unstructured stuff]
|
stm32f103 board
arduino boot loader
triple usb serial
pill_serial
dpavlin@nuc:/nuc/stm32/pill_serial$ cat flash.sh
sudo ../stlink/build/Release/st-flash write src/pill_serial.bin 0x08000000
lower serial speed to 9600 so we can use slow sensors on it: serial-speed.diff
bluepill-serial-monster
https://github.com/r2axz/bluepill-serial-monster
openocd with raspberry pi
http://git.rot13.org/?p=openocd-rpi2-stm32;a=blob;f=openocd-rpi.txt
clones
https://github.com/thanks4opensource/buck50/issues/2
https://github.com/keirf/Greaseweazle/wiki/STM32-Fakes
dpavlin@nuc:/nuc/stm32/Greaseweazle$ wget https://github.com/keirf/Greaseweazle/releases/download/v0.22/Greaseweazle-v0.22.zip
dpavlin@nuc:/nuc/stm32/Greaseweazle$ unzip Greaseweazle-v0.22.zip Greaseweazle-v0.22/alt/Blinky_Test-v0.22.hex
Archive: Greaseweazle-v0.22.zip
inflating: Greaseweazle-v0.22/alt/Blinky_Test-v0.22.hex
write it to flash using openocd
> flash write_image erase /nuc/stm32/Greaseweazle/Greaseweazle-v0.22/alt/Blinky_Test-v0.22.hex 0 ihex
auto erase enabled
wrote 5120 bytes from file /nuc/stm32/Greaseweazle/Greaseweazle-v0.22/alt/Blinky_Test-v0.22.hex in 0.299529s (16.693 KiB/s)
serial output is on the programming interface at pins A9/TX and A10/RX: Not via the USB port!
pi@pihdmi:/nuc/stm32/buck50 $ microcom -p /dev/ttyUSB1
connected to /dev/ttyUSB1
Escape character: Ctrl-\
Type the escape character to get to the prompt.
** Blinky
** Blinky Test **
** Keir Fraser <keir.xen@gmail.com>
** https://github.com/keirf/Greaseweazle
Serial = ff48:0670:8967:5655:4740:6706
Flash Size = 128kB
Device ID = 0x0000
Revision = 0x0000
Testing I2C1... OK
Testing I2C2... OK
Testing SPI1... OK
Testing SPI2... OK
Testing TIM1... OK
Testing TIM2... OK
Testing TIM3... OK
Testing TIM4... OK
DMA Test #1... OK
DMA Test #2... OK
DMA Test #3... OK
DMA Test #4... OK
Testing 64kB Flash... OK
Enable TIM4 IRQ... .OK
Testing 20kB SRAM (endless loop)................................................................
After flashing this test, you will not be able to address blue pill using openocd.
To work-around this problem, I switched boot0 jumper, used stm32loader (after pressing reset button) to load alternative binary.
Updated by Dobrica Pavlinušić on Aug 8 12:52am
Posted by Dobrica Pavlinušić on Feb 9 12:12am
|
Weblog Navigation
Loading...
|