核心结论
是的,你需要自己编译 MCU 固件。你使用的 S100_MCU_DEBUG.elf 存在明显问题:
日志分析
| MCU 核心 | 状态 | 问题 |
|---|---|---|
| MCU0 | MCU FreeRtos Lite Init Success |
|
| MCU1 | Synchronous external abort @ 0x23400298 |
错误码解读:
DFSR: 0x1210= Synchronous external abort(同步外部中止)PC: 0xcab6547= 崩溃时的程序计数器- 这是内存访问异常,通常意味着 DEBUG 固件的 CAN 驱动有 bug
解决方案
方案 1:尝试 RELEASE 版本固件(推荐先试)
DEBUG 版本不稳定,先试试 RELEASE 版本:
# 1. 下载 RELEASE 固件
wget https://archive.d-robotics.cc/downloads/os_images/rdk_s100/S100_MCU_RELEASE.elf
# 2. 烧录到 MCU1
sudo cp S100_MCU_RELEASE.elf /lib/firmware/
sudo echo "S100_MCU_RELEASE.elf" > /sys/class/remoteproc/remoteproc_mcu1/firmware
# 3. 重启 MCU1
sudo echo "start" > /sys/class/remoteproc/remoteproc_mcu1/state
# 4. 验证状态
cat /proc/remoteproc_mcu1
方案 2:自己编译 MCU 固件(最可靠)
如果 RELEASE 版本也不行,需要自己编译:
# 1. 获取 MCU SDK
git clone https://github.com/D-Robotics/mcu-community.git
cd mcu-community
# 2. 配置编译环境
python3 build_freertos.py lite matrix B s100 mcu1 gcc release
# 3. 编译
python3 build_freertos.py lite matrix B s100 mcu1 gcc release --build
# 4. 生成的固件位置
# output/s100_mcu1_release/S100_MCU.elf
关键配置: 确保 CAN 驱动在编译配置中启用:
# 检查 Config/McalCdd/gen_s100_sip_B_mcu1/Can/src/Can_PBcfg.c
# 确认 CAN8/CAN9 通道已配置
快速验证步骤
# 1. 检查当前 MCU 状态
cat /proc/remoteproc_mcu0
cat /proc/remoteproc_mcu1
# 2. 查看 CAN 通道是否注册
ip link show | grep can
# 3. 检查系统日志中的 CAN 错误
dmesg | grep -i "can\|mcu"
# 4. 重启 MCU 子系统
sudo echo "stop" > /sys/class/remoteproc/remoteproc_mcu1/state
sudo echo "start" > /sys/class/remoteproc/remoteproc_mcu1/state
参考资源
- MCU 开发指南:【S100-MCU-UseGuide】环境准备与开发流程
- CAN 配置案例:S100 MCU CAN 通讯打通
- 固件编译教程:S100P MCU 编译下载后无法运行
下一步建议
- 先试 RELEASE 固件(5 分钟搞定)
- 如果还不行,自己编译 MCU 固件(需要 1-2 小时配置环境)
- 编译时注意:确保 CAN8/CAN9 通道在配置文件中正确映射
你的 CAN 收发问题 90% 是 MCU1 崩溃导致的,先解决固件问题,再调配置文件。
需要我帮你找具体的编译配置示例吗?