Skip to content

Commit

Permalink
platform: add Radxa CM5 IO platform support
Browse files Browse the repository at this point in the history
Signed-off-by: Nascs <nascs@radxa.com>
  • Loading branch information
nascs authored and tingleby committed Nov 8, 2023
1 parent 651131b commit d055b45
Show file tree
Hide file tree
Showing 10 changed files with 317 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ ARM
* [Radxa ROCK 3C](../master/docs/radxa_rock_3c.md)
* [Radxa ROCK 5A](../master/docs/radxa_rock_5a.md)
* [Radxa ROCK 5B](../master/docs/radxa_rock_5b.md)
* [Radxa CM5 IO](../master/docs/radxa_cm5_io.md)
* [Rock Pi 4](../master/docs/rockpi4.md)
* [Orange Pi Prime](../master/docs/orange_pi_prime.md)

Expand Down
33 changes: 32 additions & 1 deletion api/mraa/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ typedef enum {
MRAA_ORANGE_PI_PRIME = 31, /**< Orange Pi Prime board */
MRAA_RADXA_ROCK_3B = 32, /**< Radxa ROCK 3 Model B */
MRAA_RADXA_CM3 = 33, /**< Radxa CM3 */
MRAA_RADXA_CM5_IO = 34, /**< Radxa CM5 IO */

// USB platform extenders start at 256
MRAA_FTDI_FT4222 = 256, /**< FTDI FT4222 USB to i2c bridge */
Expand Down Expand Up @@ -251,6 +252,37 @@ typedef enum {
MRAA_RADXA_ROCK_5B_PIN40 = 40
} mraa_radxa_rock_5b_wiring_t;

/**
* Radxa CM5 IO GPIO numbering enum
*/
typedef enum {
RADXA_CM5_IO_PIN3 = 3,
RADXA_CM5_IO_PIN5 = 5,
RADXA_CM5_IO_PIN7 = 7,
RADXA_CM5_IO_PIN8 = 8,
RADXA_CM5_IO_PIN10 = 10,
RADXA_CM5_IO_PIN11 = 11,
RADXA_CM5_IO_PIN12 = 12,
RADXA_CM5_IO_PIN13 = 13,
RADXA_CM5_IO_PIN15 = 15,
RADXA_CM5_IO_PIN16 = 16,
RADXA_CM5_IO_PIN18 = 18,
RADXA_CM5_IO_PIN19 = 19,
RADXA_CM5_IO_PIN21 = 21,
RADXA_CM5_IO_PIN22 = 22,
RADXA_CM5_IO_PIN23 = 23,
RADXA_CM5_IO_PIN24 = 24,
RADXA_CM5_IO_PIN26 = 26,
RADXA_CM5_IO_PIN29 = 29,
RADXA_CM5_IO_PIN31 = 31,
RADXA_CM5_IO_PIN32 = 32,
RADXA_CM5_IO_PIN33 = 33,
RADXA_CM5_IO_PIN35 = 35,
RADXA_CM5_IO_PIN36 = 36,
RADXA_CM5_IO_PIN38 = 38,
RADXA_CM5_IO_PIN40 = 40
} mraa_radxa_cm5_io_wiring_t;

/**
* Radxa ROCK 3 Model B GPIO numbering enum
*/
Expand Down Expand Up @@ -283,7 +315,6 @@ typedef enum {
RADXA_ROCK_3B_PIN40 = 40
} mraa_radxa_rock_3b_wiring_t;


/**
* Radxa ROCK 3 Model C GPIO numbering enum
*/
Expand Down
32 changes: 32 additions & 0 deletions api/mraa/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ typedef enum {
ORANGE_PI_PRIME = 31, /**< Orange Pi Prime board */
RADXA_ROCK_3B = 32, /**< Radxa ROCK 3 Model B */
RADXA_CM3 = 33, /**< Radxa CM3 */
RADXA_CM5_IO = 34, /**< Radxa CM5 IO */

FTDI_FT4222 = 256, /**< FTDI FT4222 USB to i2c bridge */

Expand Down Expand Up @@ -242,6 +243,37 @@ typedef enum {
RADXA_ROCK_5B_PIN40 = 40
} RadxaRock5BWiring;

/**
* Radxa CM5 IO GPIO numbering enum
*/
typedef enum {
RADXA_CM5_IO_PIN3 = 3,
RADXA_CM5_IO_PIN5 = 5,
RADXA_CM5_IO_PIN7 = 7,
RADXA_CM5_IO_PIN8 = 8,
RADXA_CM5_IO_PIN10 = 10,
RADXA_CM5_IO_PIN11 = 11,
RADXA_CM5_IO_PIN12 = 12,
RADXA_CM5_IO_PIN13 = 13,
RADXA_CM5_IO_PIN15 = 15,
RADXA_CM5_IO_PIN16 = 16,
RADXA_CM5_IO_PIN18 = 18,
RADXA_CM5_IO_PIN19 = 19,
RADXA_CM5_IO_PIN21 = 21,
RADXA_CM5_IO_PIN22 = 22,
RADXA_CM5_IO_PIN23 = 23,
RADXA_CM5_IO_PIN24 = 24,
RADXA_CM5_IO_PIN26 = 26,
RADXA_CM5_IO_PIN29 = 29,
RADXA_CM5_IO_PIN31 = 31,
RADXA_CM5_IO_PIN32 = 32,
RADXA_CM5_IO_PIN33 = 33,
RADXA_CM5_IO_PIN35 = 35,
RADXA_CM5_IO_PIN36 = 36,
RADXA_CM5_IO_PIN38 = 38,
RADXA_CM5_IO_PIN40 = 40
} RadxaCM5IOWiring;

/**
* Radxa ROCK 3 Model B GPIO numbering enum
*/
Expand Down
1 change: 1 addition & 0 deletions docs/index.java.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Specific platform information for supported platforms is documented here:
- @ref up-xtreme
- @ref _orange_pi_prime
- @ref radxa_cm3
- @ref radxa_cm5_io
- @ref radxa_rock_3b
- @ref radxa_rock_3c
- @ref radxa_rock_5a
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Specific platform information for supported platforms is documented here:
- @ref upXtreme
- @ref _orange_pi_prime
- @ref radxa_cm3
- @ref radxa_cm5_io
- @ref radxa_rock_3b
- @ref radxa_rock_3c
- @ref radxa_rock_5a
Expand Down
47 changes: 47 additions & 0 deletions docs/radxa_cm5_io.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Radxa CM5 IO {#_Radxa}
============

The Radxa CM5 is a System on Module (SoM) based on the Rockchip RK3588s System on Chip (SoC). CM5 is compatible with Radxa CM5 IO Board. It can run android or some Linux distributions. Radxa CM5 IO features an eight core ARM processor, 64bit dual channel 3200Mb/s LPDDR4, up to 8Kp60 HDMI, MIPI DSI, MIPI CSI, 3.5mm jack with mic, 802.11 ac WIFI, Bluetooth 5.0, USB Port, GbE LAN, 40-pin color expansion header, RTC. Also, Radxa CM5 IO supports USB PD and QC powering.

Interface notes
---------------

- UART2 is enabled as the default console.
- All UART ports support baud up to 1500000.

Pin Mapping
-----------

Radxa CM5 IO has a 40-pin expansion header. Each pin is distinguished by color.

|Function4 |Function3 |Function2 |Function1 | | PIN | PIN | Function1| Function2| Function3|
|------------|------------|------------|-----------|:------|------:|---------|------------|-----------|------------|
| | | |+3.3V | 1 | 2 | +5.0V| | | |
| | |I2C7_SDA_M2 |GPIO3_D3 | 3 | 4 | +5.0V| | | |
| | |I2C7_SCL_M2 |GPIO3_D2 | 5 | 6 | GND| | | |
| | |I2C5_SDA_M2 |GPIO4_A7 | 7 | 8 | GPIO0_B5| UART2_TX_M0|I2C1_SCL_M0| |
| | | |GND | 9 | 10 | GPIO0_B6| UART2_RX_M0|I2C1_SDA_M0| |
| |UART3_RX_M2 |I2C5_SCL_M2 |GPIO4_A6 | 11 | 12 | GPIO0_C2| | | |
| |UART3_TX_M2 |I2C3_SDA_M2 |GPIO4_A5 | 13 | 14 | GND| | | |
| | |I2C3_SCL_M2 |GPIO4_A4 | 15 | 16 | GPIO1_C4| PWM11_IR_M2| | |
| | | |+3.3V | 17 | 18 | GPIO1_D5| | | |
| | |SPI0_MOSI_M1|GPIO4_A1 | 19 | 20 | GND| | | |
| | |SPI0_MISO_M1|GPIO4_A0 | 21 | 22 | GPIO1_B1| | | |
| | |SPI0_CLK_M1 |GPIO4_A2 | 23 | 24 | GPIO4_B2| SPI0_CS0_M1| PWM14_M1| |
| | | |GND | 25 | 26 | GPIO3_B7| | | |
| | | |+3.3V | 27 | 28 | +3.3V| | | |
| | |PWM7_IR_M0 |GPIO0_D0 | 29 | 30 | GND| | | |
| | |PWM6_M0 |GPIO0_C7 | 31 | 32 | GPIO1_B7| PWM13_M2| | |
| | | |GPIO1_C1 | 33 | 34 | GND| | | |
| | | |GPIO3_C0 | 35 | 36 | GPIO1_C6| PWM15_IR_M2| | |
| | | |SARADC_VIN4| 37 | 38 | GPIO1_D2| PWM0_M1| | |
| | | |GND | 39 | 40 | GPIO0_D3| | | |

Resources
---------

You can find additional product support in the following channels:

- [Product Info](https://docs.radxa.com/compute-module/cm5)
- [Forums](https://forum.radxa.com/c/rock5)
- [Github](https://github.com/radxa)
30 changes: 30 additions & 0 deletions include/arm/radxa_cm5_io.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Author: Nascs <nascs@radxa.com>
* Copyright (c) Radxa Limited.
*
* SPDX-License-Identifier: MIT
*/

#pragma once

#ifdef __cplusplus
extern "C" {
#endif

#include "mraa_internal.h"

#define MRAA_RADXA_CM5_IO_GPIO_COUNT 25
#define MRAA_RADXA_CM5_IO_I2C_COUNT 4
#define MRAA_RADXA_CM5_IO_SPI_COUNT 1
#define MRAA_RADXA_CM5_IO_UART_COUNT 2
#define MRAA_RADXA_CM5_IO_PWM_COUNT 7
#define MRAA_RADXA_CM5_IO_AIO_COUNT 1
#define MRAA_RADXA_CM5_IO_PIN_COUNT 40
#define PLATFORM_NAME_RADXA_CM5_IO "Radxa CM5 IO"

mraa_board_t *
mraa_radxa_cm5_io();

#ifdef __cplusplus
}
#endif
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ set (mraa_LIB_ARM_SRCS_NOAUTO
${PROJECT_SOURCE_DIR}/src/arm/radxa_cm3.c
${PROJECT_SOURCE_DIR}/src/arm/radxa_rock_5a.c
${PROJECT_SOURCE_DIR}/src/arm/radxa_rock_5b.c
${PROJECT_SOURCE_DIR}/src/arm/radxa_cm5_io.c
${PROJECT_SOURCE_DIR}/src/arm/rockpi4.c
${PROJECT_SOURCE_DIR}/src/arm/adlink_ipi.c
${PROJECT_SOURCE_DIR}/src/arm/siemens/iot2050.c
Expand Down
6 changes: 6 additions & 0 deletions src/arm/arm.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "arm/radxa_rock_3c.h"
#include "arm/radxa_rock_5a.h"
#include "arm/radxa_rock_5b.h"
#include "arm/radxa_cm5_io.h"
#include "arm/rockpi4.h"
#include "arm/de_nano_soc.h"
#include "arm/banana.h"
Expand Down Expand Up @@ -109,6 +110,8 @@ mraa_arm_platform()
platform_type = MRAA_RADXA_ROCK_5A;
else if (mraa_file_contains("/proc/device-tree/model", PLATFORM_NAME_RADXA_ROCK_5B))
platform_type = MRAA_RADXA_ROCK_5B;
else if (mraa_file_contains("/proc/device-tree/model", PLATFORM_NAME_RADXA_CM5_IO))
platform_type = MRAA_RADXA_CM5_IO;
else if (mraa_file_contains("/proc/device-tree/model", "ROCK Pi 4") ||
mraa_file_contains("/proc/device-tree/model", "ROCK PI 4") ||
mraa_file_contains("/proc/device-tree/model", "ROCK 4")
Expand Down Expand Up @@ -155,6 +158,9 @@ mraa_arm_platform()
case MRAA_RADXA_ROCK_5B:
plat = mraa_radxa_rock_5b();
break;
case MRAA_RADXA_CM5_IO:
plat = mraa_radxa_cm5_io();
break;
case MRAA_ROCKPI4:
plat = mraa_rockpi4();
break;
Expand Down
Loading

0 comments on commit d055b45

Please sign in to comment.