laanwj / k210-sdk-stuff

Kendryte K210 / MaixGo stuff
ISC License
146 stars 31 forks source link

Maix Amigo Support? #12

Open kallisti5 opened 4 years ago

kallisti5 commented 4 years ago

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

Schematic

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

kallisti5 commented 4 years ago

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 commented 4 years ago

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

And a few questions for @laanwj

laanwj commented 3 years ago

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: