Introduction

Due to the ongoing silicon chip shortage, Audesse is supporting its customers with a Raspberry Pi CM4 adapter board that replaces the existing CM3+ board and expands the available IO.

If there is any confusion, please contact us for assistance.

Comparison

The differences between the existing CM3 and CM4 designs:

Parameter CM3+ CM4
Storage 8/16/32 GB 8/16/32 GB
RAM 1 GB 1/2/4/8 GB
Onboard Wireless None Optional Wifi & bluetooth
HDMI
Linux CAN x2
Linux Digital In x6
Linux Analog In x6
Linux RS232 x1
Linux IMU x1
Ethernet 100 Mbit/s 100 Mbit/s + 1000 Mbit/s

Most GPIO are presented in a header out the back of the FlexCase if requested. We use part Samtec: TFM-110-01-L-D-RA.

Block Diagram

A block diagram of the most of the I/O for the CM4 adapter is below. The GPIO is on connector 1 and the optional Ethernet is on connector 2. The B2B connector is an internal connection between the CM4 adapter and the FlexCase mainboard.

GPIO Connector Diagram

Connector: TFM-110-01-L-D-RA.

Recommended Wire Harness: SFSD-10-XX-X-XX.XX-S
*X indicates any value is will work. Audesse often ships with SFSD-10-28-G-08.00-S.

Pinout

For GPIO connector at edge of board.

Pin Function CM4 GPIO
1 Analog Input 1 See Analog Input Section
2 Analog Input 2 See Analog Input Section
3 Analog Input 3 See Analog Input Section
4 Analog Input 4 See Analog Input Section
5 Analog Input 5 See Analog Input Section
6 Analog Input 6 See Analog Input Section
7 Not Connected Not Connected
8 Not Connected Not Connected
9 Digital Input 1 GPIO 22, Pin 46
10 Digital Input 2 GPIO 23, Pin 47
11 Digital Input 3 GPIO 24, Pin 45
12 Digital Input 4 GPIO 25, Pin 41
13 Digital Input 5 GPIO 26, Pin 24
14 Digital Input 6 GPIO 27, Pin 48
15 CAN0 High See CAN Section
16 CAN0 Low See CAN Section
17 CAN1 High See CAN Section
18 CAN1 Low See CAN Section
19 RS232 RX See RS232 Section
20 RS232 TX See RS232 Section

 

Recommendations

We recommend utilizing the CM4 adapter in 3 possible configurations.

1) Not using any of the additional I/O – The CM4 will operate exactly the same as the existing FlexCase, but may have Wi-Fi and Bluetooth.

2) Pack and send I/O to the MCU – Write a script to configure the CM4 to act as a go between for the MCU, sending sensor data and relaying commands over the SPI communication.

3) Separate Co-processing – Write scripts to run independently of the MCU, possibly communicating between the two.

Software Support

The additional hardware is connected to the CM4 in the following fashion. It has been purposely chosen to remain as similar as possible to existing modules for code portability. Please reach out to us for additional support as required.

SPI Interface Change (Required to Prevent Damage)

The SPI hardware interface between the MCU and MPU has been moved to SPI1_CS0 instead of SPI2_CS0, due to SPI2 not being available on the CM4. Please note the change for your code deployments, and when completing tutorials that involve the MPU SPI comms.

Due to differences in the boot behavior between the CM3 and CM4, an initial delay in the MCU code is required. In the hardware modules config section of the Audesse sample software, add the System Start Function Declaration Code block and enter the following code in the Declaration area:

Copy to Clipboard

This will add a ~100ms delay before initializing the MCU peripherals. Without this block, the MCU may render the CM4 temporarily inoperable. Please contact us if your CM4 has become unresponsive.

If you plan to simultaneously read data from the multiple interfaces on SPI1 and (MCU, Linux ADC, Linux IMU) , it is recommended to modify the default SPI communication on the MCU to decrease potential interreference. The following code can be added to the same Custom Code block that the start delay, in the Exit Code Section Instead of the Declaration Code Section:

Copy to Clipboard

Keep in mind that embedded register access is generally not recommended due to the potential to cause unexpected behaviors, so use with caution.

HDMI

We supply a full size HDMI 2.0 interface, capable of driving up to 4Kp60.

Linux CAN

CAN is implemented via the MCP2515 chip via the SPI0 interface on both chip select 0 and 1. The pin configuration is as below:

Function CM4 GPIO
MISO 9
MOSI 10
SCLK 11
CAN0 CS 8
CAN1 CS 7

The board is designed to emulate the popular CAN hat PiCAN2 Duo, implemented on the same pins. The guides available there will work the same. For Simulink support please see the Raspberry Pi canChannel Support.

For basic functionality, the following python code allows reading the most recent CAN message on CAN0, which is a similar method to the other SPI-based peripherals (see Linux Analog In, Linux IMU later in the guide).

Copy to Clipboard

Linux Digital In

The digital input circuit is protected against high voltages and hardware pulled up to 5V. Please contact us for a pull down integration.

Digital In 1-6 on the Linux GPIO connector correspond to GPIO 22-27 on the CM4. Common ways to read the GPIOs include the terminal command raspi-gpio get <num> or using the GPIO Read block included in the Simulink Raspberry Pi Support Package.

Linux Analog In

The analog input is implemented using a SPI-based chip on SPI1, CS1. The single-ended measurement range is 0-36V in 10bit resolution, with the ability for differential modes. Please keep in mind that SPI1 is also used by the MCU and the Linux IMU inputs, so care must be taken to coordinate the different communication channels. The following python code shows reading of the ADC module.

Copy to Clipboard

Linux RS232

RS232 is implemented in the same way as the RS232 serial hat, on GPIO 14 (TXD0) and GPIO 15 (RXD0). Using the raspi-config tool, enable serial without enabling serial shell access. After rebooting, the serial port can be used through terminal or through the Simulink Raspberry Pi Support Package Serial Write block (/dev/serial0).

Linux IMU

We include an ASM330LHH on the SPI1, CS2 interface. The following python code provides a starting point for reading and writing to the IMU registers. Please consult the IMU datasheet for more details. Please keep in mind that SPI1 is also used by the MCU and the Linux Analog inputs, so care must be taken to coordinate the different communication channels.

Copy to Clipboard

The IMU works similarly to the original FlexCase accelerometer, with alternate register addresses and modes. For additional understanding of the functionality, we recommend completing the accelerometer guide and then moving onto the IMU.

Ethernet

When ordered, the adapter board can come equipped with gigabit ethernet, allowing for 2 simultaneous ethernet connections to the FlexCase. The connections are achieved through a Samtec TFM-104-02-L-D. The pins can be directly connected to a field wireable RJ45 or X-coded M12 connector with a precrimped harness such as the Samtec SFSD-04-28-G-03.25-S.