This is a remote playground to learn more about different types of software components that can be used in industrial setups.
To make the experience fit your profile, pick a username and tell us what interests you.
We found and based on your interests.
Short update: I Short update: I had to modify the ATOM HUB SwitchD modules for the CANopen example in Zephyr OS. The example uses red and green lights that are turned on and off. At first I thought I could use the relays of these modules. But after a while the clicking became very annoying. I opened them up and replaced the relays with LEDs.
Short update: I added the M5Stack Atom Lite (main part of the ATOM HUB SwitchD) to Zephyr OS
https://github.com/zephyrproject-rtos/zephyr/tree/main/boards/m5stack/m5stack_atom_lite
I made some small changes/additions to the board.
First I had to add a USB hub. Unfortunately the Raspi could not recognize all three M5 modules at once.
Second, I made a simple HAT for the Raspi. The Raspi now has 6 GPIOs ( 2x I2C and 2xPWM) connected to the M5 modules. The Atom Hub SwitchD modules are connected to the I2C via the extra Grove port on the SwitchD. The M5StickC Plus has PWM0 and PWM1 connected to the Grove port via a low pass filter.
With this setup I am now able to simulate some sensors with the Raspi. This means I can now build a closed loop test setup where everything is controlled by the Raspi.
I also made a pull request to add the ATOM Lite to the Zephyr OS repo: https://github.com/zephyrproject-rtos/zephyr/pull/68190
And many thanks to Benjamin Cabé who prepared a large part of this board support package!
The CAN bus modules are only connected to two ATOM HUB SwitchDs. The "intelligence" in one SwitchD is an ATOM Lite. It contains the same ESP32-PICO as the M5StickC Plus, but the gpio pins are used differently.
As many of you may know, Zephyr OS needs to know what target it is built for and in what setting. So not only the MCU, but also the used data buses and some peripherals.
Unfortunately, the ATOM Lite is currently not available as a target
https://github.com/zephyrproject-rtos/zephyr/tree/main/boards/xtensa/
but the M5StickC Plus can be used.
To build the
https://github.com/zephyrproject-rtos/zephyr/tree/main/modules/canopennode
example, the following command can be used
$ west build -b m5stickc_plus samples/modules/canopennode -- -DCONF_FILE="prj_no_storage.conf"
The only thing that needs to be added to the build is the overlay file that enables the CAN module and sets the RX/TX pins.
How to use a device tree overlay in Zephyr can be found here
https://docs.zephyrproject.org/latest/build/dts/howtos.html#set-devicetree-overlays
NOTE: The CAN bus is called the TWAI (Two-Wire Automotive Interface) on the ESP32.
To enable the TWAI in the ATOM Lite, the following lines are required in the overlay file:
&twai {
status = "okay";
pinctrl-0 = <&twai_default>;
pinctrl-names = "default";
bus-speed = <125000>;
can-transceiver {
max-bitrate = <1000000>;
};
};
&pinctrl {
twai_default: twai_default {
group1 {
pinmux = <TWAI_RX_GPIO32>,
<TWAI_TX_GPIO26>;
};
};
};
Maybe when I start using the ATOM Lite more with Zephyr, I will try to create a target for it and commit it to source. Like I did with the nRF52840 MDK USB dongle
https://github.com/zephyrproject-rtos/zephyr/tree/main/boards/arm/nrf52840_mdk_usb_dongle
Zephyr OS on ESP32
As mentioned in the description, all three modules of the M5Stack are ESP32s. I already had my Zephyr toolchain set up for ARM, but I had never used Zephyr on an ESP32 before. I found this Youtube channel very helpful:
https://www.youtube.com/@thepullupresistor
TIP: If you write your Zephyr code outside the usual zephyr folder, do not forget to source the zephyr-env.sh file before building the project!
$ cd MY_PROJECT_FOLDER
$ source ../../zephyrproject/zephyr/zephyr-env.sh
$ west build -b esp32
Remote flash
As mentioned in the description, I want everything to be available remotely. But to flash Zephyr OS, I would need the toolchain on the Raspberry Pi. The Raspi runs Raspberry Pi OS. I learned from the internet that it is not easy/possible to set up the Zephyr OS toolchain for this operating system. It is recommended to use Ubuntu on the Raspi for this use case. Unfortunately, I had already set up my Raspi as an edge router for OpenThread with the Raspberry Pi OS and did not want to do that again. So I found a Linux tool called usbip. With this tool it is possible to mount a USB port over the network. Everything I need to do is written here: https://developer.ridgerun.com/wiki/index.php/How_to_setup_and_use_USB/IP
Create an account to leave a comment. Already have an account? Log In.
For now there are just two M5 Modules and the BBB.
The intent is to have a hardware (playground) for testing and learning for example Zephyr OS in combination with CAN or RS485. And of course all the protocols that ran on these two busses.
I hope that I manage to post a new log by the end of this week. For now I am focused in Zephyr OS and CANopen.
look at https://reticulum.network/ and https://meshtastic.org/
Become a member to follow this project and never miss any updates
About Us Contact Hackaday.io Give Feedback Terms of Use Privacy Policy Hackaday API Do not sell or share my personal information
What CAN devices are connected? Or are going to be connected? What is the intent?