k210-sdk-stuff icon indicating copy to clipboard operation
k210-sdk-stuff copied to clipboard

Maix Amigo Support?

Open kallisti5 opened this issue 3 years ago • 3 comments

The Maix Amigo is shipping and getting more widely used. I think the pins differ on this one (like all the Maix devices)

https://www.seeedstudio.com/Sipeed-Maix-Amigo-p-4689.html

Platform information

  • SoC – Kendryte K210 Dual-core 64-bit RISC-V (RV64GC) processor with FPU @ 400 MHz (overclockable to 500MHz), 8MB SRAM, built-in AI accelerators for video and audio
  • Storage – 16MB Flash, MicroSD card slot up
  • Display – 3.5-inch TFT capacitive touch screen display with 480×320 resolution
  • Camera
    • VGA front-facing camera up to 30 fps (GC0328 sensor)
    • VGA rear camera up to 60 fps (OV7740 sensor)
  • Audio – 6+1 microphone array
  • USB – 1x USB Type-C port for power and programming
  • Expansion
    • 3x Grove ports with I2C, GPIO, etc…
    • 3x 8-pin SP-MOD headers with GPIOs, 3.3V, and GND signals; compatible with ESP-01 ESP8266 WiFi module, PSRAM modules, etc…
  • Sensor – Accelerometer
  • Misc – Reset button, 3x function buttons, 3x LEDs
  • Battery – 520 mAh Lithium battery
  • Power Supply – Via USB-C port
  • Dimensions – 104.3 x 63.3 x 16.5mm

Schematic

http://api.dl.sipeed.com/shareURL/MAIX/HDK/Sipeed-Amigo/2960

kallisti5 avatar Nov 28 '20 17:11 kallisti5

actually this code does work on the Maix Amigo!

Fixing the LCD resolution:

$ git diff
diff --git a/rust/k210-shared/src/board/def.rs b/rust/k210-shared/src/board/def.rs
index 3826929..5efd3fe 100644
--- a/rust/k210-shared/src/board/def.rs
+++ b/rust/k210-shared/src/board/def.rs
@@ -1,9 +1,9 @@
 //! Global board definitions for Sipeed Maix Go
 
 /** Display width in pixels */
-pub const DISP_WIDTH: u16 = 320;
+pub const DISP_WIDTH: u16 = 480;
 /** Display height in pixels */
-pub const DISP_HEIGHT: u16 = 240;
+pub const DISP_HEIGHT: u16 = 320;
 /** Number of pixels in display */
 pub const DISP_PIXELS: usize = (DISP_WIDTH as usize) * (DISP_HEIGHT as usize);
 
diff --git a/rust/k210-shared/src/board/lcd.rs b/rust/k210-shared/src/board/lcd.rs
index a9678a3..d92348d 100644
--- a/rust/k210-shared/src/board/lcd.rs
+++ b/rust/k210-shared/src/board/lcd.rs
@@ -15,8 +15,8 @@ use crate::soc::dmac::{DMAC,dma_channel};
 pub const SPI_CS: u32 = 3;
 pub const DCX_GPIONUM: u8 = 2;
 pub const RST_GPIONUM: u8 = 3;
-pub const LCD_X_MAX: u16 = 240;
-pub const LCD_Y_MAX: u16 = 320;
+pub const LCD_X_MAX: u16 = 320;
+pub const LCD_Y_MAX: u16 = 480;
 /** SPI clock (this seems to be the highest possible value which is reliable on both my MaixGo
  * boards) */
 pub const SPI_CLK: u32 = 18_000_000;

Removing the "-B xxx" from the kflash: kflash.py -t -s -p /dev/ttyUSB1 k210-console

Things seem to be working! :-D

I feel like k210-shared should be Crate? (k210 or something?)

kallisti5 avatar Nov 28 '20 18:11 kallisti5

Hm. display is reversed left-to-right. So, action items:

  • k210-shared needs adjustable display resolution
  • k210-shared needs adjustable default pin mappings for other devices
  • MAIX Amigo is XY_LRUD instead of YX_LRUD (non-issue)

And a few questions for @laanwj

  • Would you be interested in help making k210-shared into a rust crate?
  • Would you be interested in breaking k210-shared out into it's own git repository?

kallisti5 avatar Nov 28 '20 18:11 kallisti5

Glad to hear that you got it to work. I'm very surprised that the ST8849V code works for a completely different display (albeit reversed).

And a few questions for @laanwj

I'm definitely interested in that. This was my intent at the beginning. However, I don't follow the typical rust-embedded format so I had no idea if there was interest in that at all. But it seems so.

Probably we want two crates:

  • K210 SoC functions
  • Maix Go / Maix Amigo / etc board functionality

laanwj avatar Nov 29 '20 17:11 laanwj