diff --git a/api/mraa/types.h b/api/mraa/types.h index ac14f26..c1fc288 100644 --- a/api/mraa/types.h +++ b/api/mraa/types.h @@ -62,7 +62,7 @@ typedef enum { MRAA_MTK_LINKIT = 17, /**< Mediatek MT7688 based Linkit boards */ MRAA_MTK_OMEGA2 = 18, /**< MT7688 based Onion Omega2 board */ MRAA_IEI_TANK = 19, /**< IEI Tank System*/ - MRAA_ROCKPI4 = 20, /**< Radxa ROCK PI 4 Models A/B */ + MRAA_ROCKPI4 = 20, /**< Radxa ROCK PI 4 Models A/B/C */ MRAA_ADLINK_IPI = 21, /**< Adlink Industrial PI */ MRAA_ADLINK_LEC_AL = 22, /**< Adlink LEC-AL*/ MRAA_ADLINK_LEC_AL_AI = 23, /**< Adlink LEC-AL*/ diff --git a/docs/rockpi4.md b/docs/rockpi4.md index 5a617aa..7e699d9 100644 --- a/docs/rockpi4.md +++ b/docs/rockpi4.md @@ -3,7 +3,7 @@ Rock Pi 4 A/B Single Board Computer {#_rockpi} ROCK Pi 4 is a Rockchip RK3399 based SBC(Single Board Computer) by Radxa. It can run android or some Linux distributions. ROCK Pi 4 features a six core ARM processor, 64bit dual channel 3200Mb/s LPDDR4, up to 4K@60 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, ROCK Pi 4 supports USB PD and QC powering. -ROCK Pi 4 comes in two models, Model A and Model B, each model has 1GB, 2GB or 4GB ram options. for detailed difference of Model A and Model B, please check Specifications. +ROCK Pi 4 comes in three models, Model A and Model B has 1GB, 2GB or 4GB ram options, Model C has 4GB ram only. For detailed difference of three models, please check Specifications. Board Support ------------- @@ -14,8 +14,8 @@ Interface notes --------------- - **UART**: ttyS0 not usable, use ttyS2 and ttyS4 -- UART2 is enabled as U-boot and Linux serial console by default. Check Rockpi4/dev/serial-console to use. Check Rockpi4/hardware/devtree_overlays to disable serial console on UART2. -- UART2 & UART4 support a wide range of baud rate. It includes but not is not limited to the following baud rates. For instance, 115200bps. 500000bps, 1500000bps and so on. +- UART2 is enabled as U-boot and Linux serial console by default. Check Rockpi4/dev/serial-console to use. Check Rockpi4/hardware/devtree_overlays to disable serial console on UART2. +- UART2 & UART4 support a wide range of baud rate. It includes but not is not limited to the following baud rates. For instance, 115200bps. 500000bps, 1500000bps and so on. - Function marked with color orange is the default function of this pin. - Except Pins for power supply, all pins are laid out directly to Soc RK3399. - For pin 3, 5, 27, 28, 29 and 31, each pin is connected to the 3.0V supply through a 4.7K pull-up resistor. @@ -34,7 +34,7 @@ PROCK Pi 4 has a 40-pin expansion header. Each pin is distinguished by color. | | +3.3V | 1 | 2 | +5.0V | | | | I2C7_SDA | 3 | 4 | +5.0V | | | | I2C7_SCL | 5 | 6 | GND | | -| | SPI2_CLK | 7 | 8 | UART2_TXD | | +| | SPI2_CLK | 7 | 8 | UART2_TXD | | | | GND | 9 | 10 | UART2_RXD | | | | PWM0 | 11 | 12 | I2S1_SCLK | | | | PWM1 | 13 | 14 | GND | | @@ -46,13 +46,12 @@ PROCK Pi 4 has a 40-pin expansion header. Each pin is distinguished by color. | | GND | 25 | 26 | ADC_IN0 | | | | I2C2_SDA | 27 | 28 | I2C2_CLK | | | I2C6_SCL | SPI2_TXD | 29 | 30 | GND | | -| I2C6_SDA | SPI2_RXD | 31 | 32 | SPDIF_TX | UART3_CTSn | +| I2C6_SDA | SPI2_RXD | 31 | 32 | SPDIF_TX | UART3_CTSn | | | SPI2_CSn | 33 | 34 | GND | | | | I2S1_LRCK_TX| 35 | 36 | I2S1_LRCK_RX | | -| | GPIO4_D6 | 37 | 38 | I2S1_SDI | | +| | GPIO4_D6 | 37 | 38 | I2S1_SDI | | | | GND | 39 | 40 | I2S1_SDO | | - Resources --------- diff --git a/src/arm/arm.c b/src/arm/arm.c index a4c6bfc..df88e7e 100644 --- a/src/arm/arm.c +++ b/src/arm/arm.c @@ -90,9 +90,8 @@ mraa_arm_platform() platform_type = MRAA_96BOARDS; else if (mraa_file_contains("/proc/device-tree/model", "Avnet Ultra96 Rev1")) platform_type = MRAA_96BOARDS; - else if (mraa_file_contains("/proc/device-tree/model", "ROCK Pi 4") || - mraa_file_contains("/proc/device-tree/model", "ROCK PI 4A") || - mraa_file_contains("/proc/device-tree/model", "ROCK PI 4B") + else if (mraa_file_contains("/proc/device-tree/model", "ROCK Pi 4") || + mraa_file_contains("/proc/device-tree/model", "ROCK PI 4") ) platform_type = MRAA_ROCKPI4; else if (mraa_file_contains("/proc/device-tree/compatible", "raspberrypi,")) @@ -116,16 +115,16 @@ mraa_arm_platform() break; case MRAA_96BOARDS: plat = mraa_96boards(); - break; + break; case MRAA_ROCKPI4: - plat = mraa_rockpi4(); + plat = mraa_rockpi4(); break; case MRAA_DE_NANO_SOC: plat = mraa_de_nano_soc(); break; - case MRAA_ADLINK_IPI: - plat = mraa_adlink_ipi(); - break; + case MRAA_ADLINK_IPI: + plat = mraa_adlink_ipi(); + break; default: plat = NULL; syslog(LOG_ERR, "Unknown Platform, currently not supported by MRAA"); diff --git a/src/arm/rockpi4.c b/src/arm/rockpi4.c index aa5109f..2d06554 100644 --- a/src/arm/rockpi4.c +++ b/src/arm/rockpi4.c @@ -15,17 +15,16 @@ #include "common.h" #define DT_BASE "/proc/device-tree" -/* +/* * "Radxa ROCK Pi 4" is the model name on stock 5.x kernels -* "ROCK PI 4A", "ROCK PI 4B" is used on Radxa 4.4 kernel +* "ROCK PI 4A", "ROCK PI 4B" and "ROCK PI 4C" is used on Radxa 4.4 kernel * so we search for the string below by ignoring case */ -#define PLATFORM_NAME_ROCK_PI_4 "ROCK Pi 4" -#define PLATFORM_NAME_ROCK_PI_4A "ROCK PI 4A" -#define PLATFORM_NAME_ROCK_PI_4B "ROCK PI 4B" +#define PLATFORM_NAME_ROCK_PI4 "ROCK Pi 4" +#define PLATFORM_NAME_ROCK_PI4_2 "ROCK PI 4" #define MAX_SIZE 64 -const char* rockpi4_serialdev[MRAA_ROCKPI4_UART_COUNT] = { "/dev/ttyS2","/dev/ttyS4"}; +const char* rockpi4_serialdev[MRAA_ROCKPI4_UART_COUNT] = { "/dev/ttyS2", "/dev/ttyS4" }; void mraa_rockpi4_pininfo(mraa_board_t* board, int index, int sysfs_pin, mraa_pincapabilities_t pincapabilities_t, char* fmt, ...) @@ -39,9 +38,9 @@ mraa_rockpi4_pininfo(mraa_board_t* board, int index, int sysfs_pin, mraa_pincapa vsnprintf(pininfo->name, MRAA_PIN_NAME_SIZE, fmt, arg_ptr); if( pincapabilities_t.gpio == 1 ) { - va_arg(arg_ptr, int); - pininfo->gpio.gpio_chip = va_arg(arg_ptr, int); - pininfo->gpio.gpio_line = va_arg(arg_ptr, int); + va_arg(arg_ptr, int); + pininfo->gpio.gpio_chip = va_arg(arg_ptr, int); + pininfo->gpio.gpio_line = va_arg(arg_ptr, int); } pininfo->capabilities = pincapabilities_t; @@ -71,11 +70,10 @@ mraa_rockpi4() if (mraa_file_exist(DT_BASE "/model")) { // We are on a modern kernel, great!!!! - if (mraa_file_contains(DT_BASE "/model", PLATFORM_NAME_ROCK_PI_4) || - mraa_file_contains(DT_BASE "/model", PLATFORM_NAME_ROCK_PI_4A) || - mraa_file_contains(DT_BASE "/model", PLATFORM_NAME_ROCK_PI_4B) + if (mraa_file_contains(DT_BASE "/model", PLATFORM_NAME_ROCK_PI4) || + mraa_file_contains(DT_BASE "/model", PLATFORM_NAME_ROCK_PI4_2) ) { - b->platform_name = PLATFORM_NAME_ROCK_PI_4; + b->platform_name = PLATFORM_NAME_ROCK_PI4; b->uart_dev[0].device_path = (char*) rockpi4_serialdev[0]; b->uart_dev[1].device_path = (char*) rockpi4_serialdev[1]; } @@ -88,7 +86,7 @@ mraa_rockpi4() b->uart_dev[1].index = 4; // I2C - if (strncmp(b->platform_name, PLATFORM_NAME_ROCK_PI_4, MAX_SIZE) == 0) { + if (strncmp(b->platform_name, PLATFORM_NAME_ROCK_PI4, MAX_SIZE) == 0) { b->i2c_bus_count = MRAA_ROCKPI4_I2C_COUNT; b->def_i2c_bus = 0; b->i2c_bus[0].bus_id = 7;