19.10.2021 – Embedded/FPGA/Run_Modelsim_integrated_in_Lattice_Radiant_on_Linux.md

Run Modelsim integrated in Lattice Radiant on Linux

This fixes one issue causing Modelsim not starting from within Lattice Radiant, at least for versions 2.0 - 3.0, and most likely Lattice Diamond. The Modelsim binaries are linked against 32-bit libraries which aren’t usually installed on a recent system.

To see if that is the cause

1
2
$ file ~/lscc/radiant/3.0/modeltech/linuxloem/vish
vish: ELF 32-bit LSB executable, Intel 80386, ...

If this returns ...ELF 32-bit... then check which libraries are missing

1
2
3
4
$ ldd ~/lscc/radiant/3.0/modeltech/linuxloem/vish | grep not\ found
        libXft.so.2 => not found
        libXrender.so.1 => not found
        libfontconfig.so.1 => not found

Add package sources for i386 packages

1
2
$ sudo dpkg --add-architecture i386
$ sudo apt update

Install required libraries

1
$ sudo apt install --no-install-recommends libxft2:i386 libxrender1:i386 libfontconfig1:i386

Adding no-install-recommends helps keeping installed libs to a minimum.

10.10.2019 – Embedded/Communication/Minicom_sending_unsolicited_data.md

Minicom sending unsolicited data

If minicom is sending unsolicited data after reconnecting, e.g. AT commands, ModemManager is very likely the source.

Find out with

1
$ ps -ax | grep Modem

Permanently eliminate with

1
2
$ sudo systemctl stop ModemManager
$ sudo systemctl disable ModemManager
04.09.2019 – Embedded/ChibiOS/Enable_syscalls_in_ChibiOS.md

Enable syscalls in ChibiOS

If syscalls such as _read, _write, _sbrk, ... are needed in ChibiOS, add os/various/syscalls.c to the Makefile.

Those functions are needed for some stdlib functions such as malloc, atof, ...

If syscall implementations are missing the linker fails with errors such as undefined reference to '_sbrk'

19.07.2019 – Embedded/Raspberry_Pi/Simple_traffic_monitoring_with_a_Raspberry_Pi.md

Simple traffic monitoring with a Raspberry Pi

Connect the wired ethernet interface to regular network. Setup wireless interface as Access Point with WPS enabled. Especially useful to explore the activity of IoT devices.

Install required tools

1
$ apt-get install hostapd dnsmasq

Edit/Create /etc/hostapd/hostapd.conf

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
interface=wlan0
driver=nl80211
channel=1

ssid=RPiProxy
wpa=2
# Change passphrase
wpa_passphrase=somePassphrase
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
wpa_group_rekey=600
wpa_gmk_rekey=86400

# Enable WPS if needed
ctrl_interface=/var/run/hostapd
eap_server=1
wps_state=2
ap_setup_locked=1
wps_pin_requests=/var/run/hostapd.pin-req
device_name=USB2.0 WLAN
manufacturer=ATHEROS
model_name=WAP
model_number=123
serial_number=12345
device_type=6-0050F204-1
os_version=01020300
config_methods=label display push_button keypad

Edit/Create /etc/dnsmasq.d/monitor.conf

1
2
3
4
5
6
log-facility=/var/log/dnsmasq.log
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.250,12h
dhcp-option=3,10.0.0.1
dhcp-option=6,10.0.0.1
log-queries

Configure interfaces

1
2
3
4
5
6
7
$ ifconfig wlan0 up
$ ifconfig wlan0 10.0.0.1/24
$ iptables -t nat -F
$ iptables -F
$ iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
$ iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
$ echo '1' > /proc/sys/net/ipv4/ip_forward

Enable and (re-)start

1
2
$ systemctl restart dnsmasq
$ systemctl unmask hostapd && systemctl start hostapd

Run tcpdump

1
$ tcpdump -i wlan0 -s0 -n -w ~/monitor.pcap

To push the WPS button run

1
$ hostapd_cli wps_pbc
17.07.2019 – Embedded/Raspberry_Pi/Raspbian_SSH_Configuration.md

Raspbian SSH Configuration

On raspbian sshd is disabled by default. To enable it, without attaching any monitor and keyboard, create the file /boot/ssh

1
$ touch /boot/ssh

This will permanently enable sshd on the next reboot and the file will be deleted thereafter.

Default user pi and password raspberry