Raspberry pi and stm32 communication with mrf24j40 over 802.15.4.


I am currently working with a project regarding my LED-lightening in the kitchen. The system will be based on a STM32-circuit and the communication device is a mrf24j40 which supports the 802.15.4 protocol.

The first thought was to implement the Zigbee stack but due to memory limitations that is not possible. Instead an own stack will be implemented on top of the 802.15.4 protocol. More information regarding the project will be posted later on.

Wpan-tools(https://github.com/linux-wpan/wpan-tools) was checked out, compiled and installed into the system. The ‘af_ieee802154_rx’ application was used to capture incoming packets from the STM32Discovery-board.

The STM32 implementation is found on my Github: https://github.com/payano/stm32_zigbee.

Pinout configuration:

  • PB15 – SPI MOSI
  • PB14 – SPI MISO
  • PB13 – MRF Reset
  • PF9 – SPI SCK
  • PF10 – SPI CS

The STM32Discovery board connected to mrf24j40ma is shown in figure 1.

Figure1. STM32Discovery board connected to MRF24J40ma.

MRF24J40 RASPBERRY PI 2, PIN:
Source: http://www.spinics.net/lists/linux-wpan/msg03832.html

  • INT P16, BCM 23
  • RST P1, 3.3V
  • CS P24 (CE0), BCM 8
  • SCK P23 SCLK, BCM 11
  • SDO P21, MISO, BCM 9
  • SDI P19, MOSI, BCM 10
  • 3.3V P17, 3.3V
  • GND P20, GND

The Raspberry pi connected to mrf24j40ma is shown in figure 2.

Figure 2. Raspberry pi connected to MRF24J40ma.

Raspberry Pi wpan configuration:

# iwpan dev wpan0 del
# iwpan phy phy0 interface add wpan0 type node d6:55:2c:d6:e4:1c:eb:57
# iwpan dev wpan0 set short_addr 0x0002
# iwpan dev wpan0 set pan_id 0x0023
# ip link set wpan0 up

After the configuration is done and the program is loaded into the STM32Discovery-board the communication is correctly working, the two devices have contact with each other.

The Raspberry Pi Github project can be found here: https://github.com/payano/radio_com_x64/

A video posted on youtube shows that the communication is successful. The next step is to continue developing the application on both sides to communicate the information that needs to be transferred over the network.

,

2 responses to “Raspberry pi and stm32 communication with mrf24j40 over 802.15.4.”

  1. Hello Johan,

    For an IoT course I want to set up an 802.15.4 link between a Raspberry Pi and an STM32F0 or F4 Discovery board, I am looking at this project and I plan to adapt it. I have some questions regarding the RPi software, can I contact you?
    My email is flichtschein@gmail.com.
    Best regards,

    Fernando Lichtschein

Leave a Reply to johan Cancel reply

Your email address will not be published. Required fields are marked *