Skip to content

Commit

Permalink
Merge branch 'main' into feature/out_of_tree_v2.7.5
Browse files Browse the repository at this point in the history
  • Loading branch information
takurot authored Feb 20, 2024
2 parents 266113d + 1267b0d commit eb95738
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 18 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @takurot @shujima @kokosabu @ksato9700
27 changes: 11 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# LexxPluss Main Board Software
# LexxPluss Sensor Control Board Software

[![CI](https://github.com/LexxPluss/LexxHard-MainBoard-Firmware/actions/workflows/main.yml/badge.svg)](https://github.com/LexxPluss/LexxHard-MainBoard-Firmware/actions/workflows/main.yml)
[![release](https://github.com/LexxPluss/LexxHard-MainBoard-Firmware/actions/workflows/release.yml/badge.svg)](https://github.com/LexxPluss/LexxHard-MainBoard-Firmware/actions/workflows/release.yml)
[![CI](https://github.com/LexxPluss/LexxHard-SensorControlBoard-Firmware/actions/workflows/main.yml/badge.svg)](https://github.com/LexxPluss/LexxHard-SensorControlBoard-Firmware/actions/workflows/main.yml)
[![release](https://github.com/LexxPluss/LexxHard-SensorControlBoard-Firmware/actions/workflows/release.yml/badge.svg)](https://github.com/LexxPluss/LexxHard-SensorControlBoard-Firmware/actions/workflows/release.yml)

## For Docker (Ubuntu)

## Install dependencies
## Install dependencies

```bash
$ mkdir -p $HOME/zephyrproject/
$ cd $HOME/zephyrproject/
$ git clone https://github.com/LexxPluss/LexxHard-MainBoard-Firmware
$ git clone https://github.com/LexxPluss/LexxHard-SensorControlBoard-Firmware
$ docker pull zephyrprojectrtos/zephyr-build:v0.21.0
$ docker run -it -v $HOME/zephyrproject:/workdir docker.io/zephyrprojectrtos/zephyr-build:v0.21.0

```
## Setup Zephyr

```bash
$ export ZEPHYR_BASE=/workdir/LexxHard-MainBoard-Firmware/zephyr
$ cd /workdir/LexxHard-MainBoard-Firmware
$ export ZEPHYR_BASE=/workdir/LexxHard-SensorControlBoard-Firmware/zephyr
$ cd /workdir/LexxHard-SensorControlBoard-Firmware
$ west init -l lexxpluss_apps
$ west update
$ west config --global zephyr.base-prefer configfile
Expand All @@ -37,11 +37,11 @@ $ ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb west build -b lexxpluss_mb02 bootloader/mcu
$ ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb west build -b lexxpluss_mb02 lexxpluss_apps -- -DBOARD_ROOT=$(pwd)/extra -DZEPHYR_EXTRA_MODULES=$(pwd)/extra
```
```bash
$ cp ./build/zephyr/zephyr.signed.confirmed.bin LexxHard-MainBoard-Firmware-Update-?.?.?.bin
$ cp ./build/zephyr/zephyr.signed.confirmed.bin LexxHard-SensorControlBoard-Firmware-Update-?.?.?.bin

$ dd if=/dev/zero bs=1k count=256 | tr "\000" "\377" > bl_with_ff.bin
$ dd if=build-mcuboot/zephyr/zephyr.bin of=bl_with_ff.bin conv=notrunc
$ cat bl_with_ff.bin build/zephyr/zephyr.signed.bin > LexxHard-MainBoard-Firmware-Initial-?.?.?.bin
$ cat bl_with_ff.bin build/zephyr/zephyr.signed.bin > LexxHard-SensorControlBoard-Firmware-Initial-?.?.?.bin
```

### Build firmware ( enable interlock )
Expand Down Expand Up @@ -135,17 +135,12 @@ $ st-flash --reset --connect-under-reset write build/zephyr/zephyr.signed.confir

```bash
$ st-flash --reset --connect-under-reset erase
$ st-flash --reset --connect-under-reset write LexxHard-MainBoard-Firmware-Initial-v?.?.? 0x8000000
$ st-flash --reset --connect-under-reset write LexxHard-SensorControlBoard-Firmware-Initial-v?.?.? 0x8000000
```

## Update via ROS

Use [LexxPluss/LexxHard-MainBoard-Updator](https://github.com/LexxPluss/LexxHard-MainBoard-Updator.git).

The firmware is automatically updated when the robot is turned on again after executing the following command.
```bash
$ rosrun mainboard_updator mainboard_updator LexxHard-MainBoard-Firmware-Update-v?.?.?.bin
```
(There is no updater for SensorControlBoard yet)

## License

Expand Down
13 changes: 12 additions & 1 deletion extra/boards/arm/lexxpluss_mb02/lexxpluss_mb02.dts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,dtcm = &dtcm;
zephyr,can-primary = &can2;
zephyr,can-primary = &can1;
zephyr,can-secondary = &can2;
};

soc {
Expand Down Expand Up @@ -294,6 +295,16 @@
status = "okay";
};

&can1 {
pinctrl-0 = <&can1_rx_ph14 &can1_tx_ph13>;
bus-speed = <1000000>;
sjw = <1>;
prop-seg = <0>;
phase-seg1 = <5>;
phase-seg2 = <6>;
status = "okay";
};

&i2c2 {
pinctrl-0 = <&i2c2_sda_pf0 &i2c2_scl_pf1>;
status = "okay";
Expand Down
2 changes: 1 addition & 1 deletion lexxpluss_apps/src/can_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ class can_controller_impl {
const device *dev{nullptr};
char version_powerboard[32]{""};
bool heartbeat_timeout{true}, enable_lockdown{true};
static constexpr char version[]{"2.7.0"};
static constexpr char version[]{"2.7.1"};
} impl;

int bmu_info(const shell *shell, size_t argc, char **argv)
Expand Down
8 changes: 8 additions & 0 deletions lexxpluss_apps/src/rosserial_board.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class ros_board {
nh.subscribe(sub_emergency);
nh.subscribe(sub_poweroff);
nh.subscribe(sub_lexxhard);
nh.subscribe(sub_messenger);
msg_fan.data = msg_fan_data;
msg_fan.data_length = sizeof msg_fan_data / sizeof msg_fan_data[0];
msg_bumper.data = msg_bumper_data;
Expand Down Expand Up @@ -134,6 +135,10 @@ class ros_board {
while (k_msgq_put(&can_controller::msgq_control, &ros2board, K_NO_WAIT) != 0)
k_msgq_purge(&can_controller::msgq_control);
}
void callback_messenger(const std_msgs::Bool &req) {
while (k_msgq_put(&can_controller::msgq_control, &ros2board, K_NO_WAIT) != 0)
k_msgq_purge(&can_controller::msgq_control);
}
std_msgs::UInt8MultiArray msg_fan;
std_msgs::ByteMultiArray msg_bumper;
std_msgs::Bool msg_emergency;
Expand Down Expand Up @@ -161,6 +166,9 @@ class ros_board {
ros::Subscriber<std_msgs::String, ros_board> sub_lexxhard{
"/lexxhard/setup", &ros_board::callback_lexxhard, this
};
ros::Subscriber<std_msgs::Bool, ros_board> sub_messenger{
"/lexxhard/mainboard_messenger_heartbeat", &ros_board::callback_messenger, this
};
};

}
Expand Down

0 comments on commit eb95738

Please sign in to comment.