Coder Social home page Coder Social logo

stm32-hotspot / stm32mp1-otbr-posix Goto Github PK

View Code? Open in Web Editor NEW
4.0 0.0 2.0 4.32 MB

Linux package for Openthread Border Router (OTBR) working with a Radio Co-Processor (RCP) STM32WB55 through a serial connection (FTDI) between STM32MPU and STM32WB. This meta-layer provides all recipes needed to compile "ot-br-posix".

License: Other

HTML 2.90% CSS 17.41% Shell 73.14% Python 5.31% BitBake 1.24%
ftdi openthread openthread-border-router otbr posix stm32 stm32mp1 yocto matter

stm32mp1-otbr-posix's Introduction

X-LINUX_OTBR_POSIX Linux Package

latest tag

The X-LINUX_OTBR_POSIX is a linux Package running on STM32MPU and tested on STM32MP157F-DK2. Openthread Border Router(OTBR) work with Radio Co Processor(RCP) STM32WB55 through a serial connection (FTDI) between STM32MPU and STM32WB. This meta-layer provide all recipes needed to compile ot-br-posix "https://github.com/openthread/ot-br-posix" on stm32mpu.

Two cases for RCP are available :

Matter/Openthread : Follow this github RCP-MATTER

Openthread standalone : Follow this github RCP-OPENTHREAD

Keywords

OpenThread, OTBR, WI-FI, Internet of Things, Network, Connectivity, commissioning, CSA, Connectivity Standard Alliance, STM32MP1, P-NUCLEO-WB55 ,MATTER, CHIP, IoT.

Release note

Details about the content of this release are available in the release note here.

Boards Needed

System Requirements

A Linux® PC running under Ubuntu® 18.04 or 20.04 is to be used. The developer can follow the below link. https://wiki.st.com/stm32mpu/wiki/PC_prerequisites

BUILD:

This is required to build the recipes and create STM32MP1 images (see https://wiki.st.com/stm32mpu/wiki/STM32MP1_Distribution_Package).

Create source folder

PC $> mkdir ~/stm32mp1_openthread 
PC $> cd stm32mp1_openthread

Initialize repo in the current directory

PC $> repo init -u https://github.com/STMicroelectronics/oe-manifest.git -b refs/tags/openstlinux-5.15-yocto-kirkstone-mp1-v22.11.23

Synchronize the local project directories with the remote repositories specified in the manifest (more details on 'repo sync' here)

PC $> repo sync

Get the STM32MP1 OTBR repository

PC$> git clone "https://github.com/stm32-hotspot/stm32mp1-otbr-posix.git"

Initializing the OpenEmbedded build environment

💻 For MP15, the line below 💻

PC $> DISTRO=openstlinux-weston MACHINE=stm32mp1 source layers/meta-st/scripts/envsetup.sh

💻 For MP13, the line below 💻

PC $> DISTRO=openstlinux-weston MACHINE=stm32mp13-disco source layers/meta-st/scripts/envsetup.sh

Prepare the Yocto layer related to OBTR

PC$> cp -R ../stm32mp1-otbr-posix/meta-otbr ../layers/meta-st/
PC$> bitbake-layers add-layer ../layers/meta-st/meta-otbr

Build the ST32MP1 image (this might take several hours to complete depending on your network connection and your PC performance)

PC$> bitbake st-image-otbr

Flashing the built image (STM32MP157F-DK2)

The build--/tmp-glibc/deploy/images/stm32mp1 directory receives complete file system images.

Note that the build of the Distribution Package generates the images and the Flash layout files

https://wiki.stmicroelectronics.cn/stm32mpu/wiki/STM32MP157x-DKx_-_hardware_description#Boot_related_switches

  1. MB1272 motherboard: STM32MP157x 12x12, PMIC, DDR3
  2. MicroSD card slot
  3. 2 x USB Type-A (host) → mouse, keyboard or USB driver
  4. 2 x USB Type-A (host) → mouse, Keyboard or USB driverUSB
  5. micro-B (ST-LINK/V2-1) → PC virtual COM port and debug
  6. Reset button
  7. Ethernet → Network
  8. USB Type-C (power 5V-3A)

UG_IMAGE_1

Let's flash the downloaded image on the microSD card:

  • Set the boot switches (1) to the off position
  • Connect the USB Type-C™ (OTG) port (2) to the host PC that contains the downloaded image
  • Insert the delivered microSD card into the dedicated slot (3)
  • Connect the delivered power supply to the USB Type-C™ port (4)
  • Press the reset button (5) to reset the board

UG_IMAGE_2

  1. Launch STM32CubeProgrammer to get the GUI
  2. On the top right of the window, select USB (instead of STLINK, set by default) in the connection picklist and click the "Refresh" button. The serial number is displayed if the USB is detected. Then click "Connect".

UG_IMAGE_3

  1. Refresh and press to Connect

UG_IMAGE_4

  1. Select the "Open File" tab and choose the "FlashLayout_sdcard_stm32mp157f-dk2-optee.tsv" through this path build--/tmp-glibc/deploy/images/stm32mp1/flashlayout_st-image-otbr/extensible

  2. Fill the "Binaries Path" by browsing to the build--tmp-glibc/deploy/images/stm32mp1/

UG_IMAGE_5

command lines can be run from Terminal through USB with st-link

Note: in this article, any command executed on the board (through the remote Terminal or the Wayland Terminal) starts with BOARD$> , while any command executed on the host PC starts with PC$>

Flashing the built image(STM32MP135F-DK)

The build-openstlinux-weston-stm32mp13-diso/tmp-glibc/deploy/images/stm32mp13-disco directory receives complete file system images.

Note that the build of the Distribution Package generates the images and the Flash layout files

https://wiki.stmicroelectronics.cn/stm32mpu/wiki/STM32MP157x-DKx_-_hardware_description#Boot_related_switches

  • MB1635 motherboard: STM32MP135F 11x11, PMIC, DDR3 (1)
  • USB micro-B (ST-LINK/V2-1) → PC virtual COM port and debug (11)
  • Reset button (17)

UG_IMAGE_1

  • MicroSD card slot (31)
  • 4x USB Type-A (host) → mouse, keyboard or USB driver (35)
  • Ethernet → Network (30, 32)
  • USB Type-C Programming port (33)
  • USB Type-C Power (5V-3A) (34)

UG_IMAGE_2

Let's flash the downloaded image on the microSD card

  • Set the boot switches to the OPEN position as in the picture below

UG_IMAGE_3

  • Connect the USB Type-C™ (OTG) port (33) to the host PC that contains the downloaded image
  • Insert the delivered microSD card into the dedicated slot (31)
  • Connect the power supply to the USB Type-C™ port (34)
  • Press the reset button (17) to reset the board
  • Launch STM32CubeProgrammer to get the GUI
  • On the top right of the window, select USB (instead of STLINK, set by default) in the connection picklist and click the "Refresh" button. The serial number is displayed if the USB is detected

UG_IMAGE_3

  • Then click “Connect”

UG_IMAGE_4

  • Select the "Open File" tab and choose the "FlashLayout_sdcard_stm32mp135f-dk-extensible.tsv" through this path "build-openstlinux-weston-stm32mp13- diso/tmp-glibc/deploy/images/stm32mp13-disco/flashlayout_st-image-otbr/extensible"
  • Fill the Binaries Path" by browsing to the "build-openstlinux-weston-stm32mp13-diso/tmp-glibc/deploy/images/stm32mp13-disco”

UG_IMAGE_5

Note: in this article, any command executed on the board (through the remote Terminal or the Wayland Terminal) starts with BOARD$> , while any command executed on the host PC starts with PC$>

Power up the board

Set the boot switches in SD Card boot mode as in the picture below

💻 STM32MP157F-DK2

UG_IMAGE_6

💻 STM32MP135F-DK

UG_IMAGE_7

  • Press the reset button (STM32MP157F-DK2 (6) and STM32MP135F-DK (17))
  • The following command lines can be run from a Terminal through USB with ST-LINK (STM32MP157F-DK2 port (5) and STM32MP135F-DK port (11))

Getting board IP address with Ethernet

plug in ethernet cable (7)

 BOARD$> ip addr show eth0
 eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
    inet xx.xx.xx.xx/xx brd xx.xx.xx.xx scope global dynamic eth0
       valid_lft 159045sec preferred_lft 159045sec
    inet6 xxxx::xx:xx:xx:xx/xx scope link 
       valid_lft forever preferred_lft forever

Wlan Network attachment

BOARD$>  ifconfig wlan0 up
BOARD$>  ifconfig wlan0 
         wlan0     Link encap:Ethernet  HWaddr 60:F1:89:3F:F6:0E  
            inet addr:192.168.43.135  Bcast:192.168.43.255  Mask:255.255.255.0
            UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1                   /* UP indicate that your interface is UP */
            RX packets:19 errors:0 dropped:0 overruns:0 frame:0
            TX packets:19 errors:0 dropped:0 overruns:0 carrier:0
            collisions:0 txqueuelen:1000 
            RX bytes:1774 (1.7 KiB)  TX bytes:2326 (2.2 KiB)

Scan available SSID (Access Point):

BOARD$> iw dev wlan0 scan | grep SSID
        SSID: NETWORK1
        SSID: NETWORK2

Set the Wi-Fi network name and password:

BOARD$> wpa_passphrase <your_ssid_name> <your_ssid_key> >> /etc/wpa_supplicant.conf

Check new configuration:

BOARD$> cat /etc/wpa_supplicant.conf
        ctrl_interface=/var/run/wpa_supplicant
        ctrl_interface_group=0
        update_config=1
        network={
         ssid="your_ssid_name"
         psk="your_ssid_key"
      }

Connect to SSID:

BOARD$> wpa_supplicant -B -iwlan0 -c /etc/wpa_supplicant.conf

link to SSID:

BOARD$> iw wlan0 link
        SSID: NETWORK1
        freq: 2462
        RX: 501 bytes (3 packets)
        TX: 4056 bytes (22 packets)
        signal: -75 dBm
        tx bitrate: 12.0 MBit/s
        bss flags:      short-preamble short-slot-time
        dtim period:    1
        beacon int:     100

For more information : https://wiki.st.com/stm32mpu/wiki/How_to_setup_a_WLAN_connection

Configuration otbr-posix on STM32MP1

At first boot you must modify the /usr/bin/otbr_setup.sh as described below (remove the bold line)

mydir=/usr/libexec/otbr-install/

. "${mydir}"/_initrc <= This need to be removed

. "${mydir}"/_border_routing

. "${mydir}"/_otbr

. "${mydir}"/_ipforward

. "${mydir}"/_nat64

. "${mydir}"/_dns64


For first boot you must config otbr-agent with this command
BOARD$>  bash /usr/bin/otbr_setup.sh 
BOARD$>  reboot

Example to setup Border Router

BOARD$>  ot-ctl thread stop 
BOARD$>  ot-ctl ifconfig down 
BOARD$>  ot-ctl networkkey 00112233445566778899aabbccddeeff
BOARD$>  ot-ctl extpanid 1111111122222222
BOARD$>  ot-ctl panid 1234
BOARD$>  ot-ctl channel 15 
BOARD$>  ot-ctl ifconfig up 
BOARD$>  ot-ctl thread start 

Following this link for more information https://openthread.io/guides/

stm32mp1-otbr-posix's People

Contributors

alabstm avatar huberkevstm avatar

Stargazers

 avatar  avatar  avatar  avatar

stm32mp1-otbr-posix's Issues

README.md BUILD section error

Hello,

I have tried the BUILD steps. But there is some small errors.

I would like to share with you the correct steps that I do on my PC to build the st-image-otbr, as the following:

(command:) mkdir ~/stm32mp1_openthread

(command:) cd ~/stm32mp1_openthread

(command:) git clone "https://github.com/stm32-hotspot/stm32mp1-otbr-posix.git"

[YAO: subfolder "stm32mp1-otbr-posix" is created]

(command:) repo init -u https://github.com/STMicroelectronics/oe-manifest.git -b refs/tags/openstlinux-5.15-yocto-kirkstone-mp1-v22.11.23

(command:) repo sync

[YAO: subfolder "layers" is created]

(command:) DISTRO=openstlinux-weston MACHINE=stm32mp1 source layers/meta-st/scripts/envsetup.sh

[YAO: subfolder "build-openstlinuxweston-stm32mp1" is created, and we go into subfolder "build-openstlinuxweston-stm32mp1"]

(command:) bitbake st-image-weston

[This might take up to 10 hours to complete, depends on your network connection and your PC performance ... ]

(command:) bitbake-layers create-layer ../layers/meta-st/meta-otbr

(command:) cp -r ../stm32mp1-otbr-posix/meta-otbr ../layers/meta-st/

(command:) bitbake-layers add-layer ../layers/meta-st/meta-otbr

(command:) bitbake st-image-otbr

[Again, this might take several hours to complete ... ]

Could you please check and update the READM.md ?

Best regards
Kunliang

load on an STM32MP157F-DK2

I am trying to build/run this on an STM32MP157F-DK2
When I try running bash /usr/bin/otbr_setup.sh I encounter some errors:

  • lsb_release was not installed - Easy enough - apt-get update && apt-get install -y lsb-release && apt-get clean all
  • dhcpv6_pd_uninstall: command not found
    If I comment that out to keep going
  • Failed to stop otbr-nat44.service: Unit otbr-nat44.service not loaded.
    Again commented out to
    -dpkg-query: package 'bind9' is not installed
    and
    + systemctl enable otbr-nat44 otbr-nat44.service is not a native service, redirecting to systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable otbr-nat44

Are there steps missing? Other packages I need to install? What can I do?
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.