-
Notifications
You must be signed in to change notification settings - Fork 292
Blinking LEDs over HTTP on STM32
Alex Kalmuk edited this page Oct 19, 2020
·
2 revisions
You can control LEDs over HTTP server running on Embox. In this example LEDs states and current network settings can be stored/restored from the internal flash filesystem.
- Configure and build:
make confload-project/gpio_http_admin/stm32f4_discovery && make
. - Flash Embox (more details on how to flash here).
- Run your board.
You will see how Embox mounts settings and starts httpd:
Started shell [tish] on device [diag]
loading start script:
> ifconfig lo 127.0.0.1 netmask 255.0.0.0 up
> route add 127.0.0.0 netmask 255.0.0.0 lo
> ifconfig eth0 192.168.1.128 netmask 255.255.255.0 hw ether AA:BB:CC:DD:EE:02 up
> route add 192.168.1.0 netmask 255.255.255.0 eth0
> ls /dev
/dev/stm32flash0
/dev/ttyS1
/dev/ttyS0
> mount -t DumbFS /dev/stm32flash0 /conf
> led_driver init
> flash_settings restore
Restoring flash settings
flash_settings: flashset_nic_restore: failed
flash_settings: flashset_led_restore: Error opening led
net [fail]
led [fail]
> ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::/?? Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:0
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0
RX bytes:0 (0 MiB) TX bytes:0 (0 MiB)
eth0 Link encap:Ethernet HWaddr aa:bb:cc:dd:ee:02
inet addr:192.168.1.128 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: ::/?? Scope:Host
UP BROADCAST MULTICAST MTU:1514 Metric:0
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0
RX bytes:0 (0 MiB) TX bytes:0 (0 MiB)
Interrupt:61 Base address:0x40028000
> service httpd http_admin
Starting service: httpd
embox>
- Open your browser and go to the address
http://192.168.1.128/
Now you can control LEDs and save their states to internal flash memory, so their states will be restored after reboot.
After you press 'SAVE' current LEDs states will be saved to flash, you can see in Embox shell:
embox>Storing flash settings
flash_settings: main: Storing setting "led"
You can also go to another page and see. modify and store network settings:
If you will modify and save network settings, they will be applied after reboot:
Storing flash settings
flash_settings: main: Storing setting "net"
Net configuration is saved succesffully
Rebooting now to apply new net config...
LEDs will blink:
- Embox on QEMU emulator
- ARM
- AARCH64
- x86
- MIPS
- RISC-V
- PowerPC
- DLX (Microblaze)
- SPARC
- Porting to a new architecture
- Audio
- FPGA
- FS
- Graphics
- NET
- USB
- iec61850
- C Plus Plus
- GY 30 I2C light sensor on STM32
- STM32FLASHER
- Emdocker
- Emdocker on MAC
- Xen port workflow
- Troubleshooting
- QEMU with GRUB2 and Syslinux
- LKL subsystem
- Beremiz