Hi all, just wanted to let you know that I have the Mesa 7i90HD working (first results - just the card itself) on SPI on RPI4.
Following the instructions posted here I got PREEMPT RT 4.19.59 running. I started with buster lite and had a "dtoverlay=vc4-fkms-v3d" in /boot/config.txt that I had to comment out to get HDMI output on this kernel.
I flashed the 7i90 with an SPI bitfile on a PC over EPP. Then connected it to the first SPI (SPI0 CE0) as described elsewhere on this site.
I had to modify spi_common_rpspi.h:
Code:
diff --git a/src/hal/drivers/mesa-hostmot2/spi_common_rpspi.h b/src/hal/drivers/mesa-hostmot2/spi_common_rpspi.h
index 56fe93eb8..58b30fbbd 100644
--- a/src/hal/drivers/mesa-hostmot2/spi_common_rpspi.h
+++ b/src/hal/drivers/mesa-hostmot2/spi_common_rpspi.h
@@ -45,6 +45,7 @@
#define BCM2835_AUX_END (BCM2835_AUX_BASE + sizeof(bcm2835_aux_t))
#define BCM2709_OFFSET 0x1F000000 // For RPI 2 and 3
+#define BCM2711_OFFSET 0xDE000000 // For RPI 4
#if !defined(__I) && !defined(__O) && !defined(__IO)
#ifdef __cplusplus
...and hm2_rpspi.c:
Code:
diff --git a/src/hal/drivers/mesa-hostmot2/hm2_rpspi.c b/src/hal/drivers/mesa-hostmot2/hm2_rpspi.c
index 116d6ca69..e70657d07 100644
--- a/src/hal/drivers/mesa-hostmot2/hm2_rpspi.c
+++ b/src/hal/drivers/mesa-hostmot2/hm2_rpspi.c
@@ -102,7 +102,8 @@ typedef struct hm2_rpspi_struct {
typedef enum {
RPI_UNSUPPORTED,
RPI_1, // Version 1
- RPI_2 // Version 2 and 3
+ RPI_2, // Version 2 and 3
+ RPI_4
} platform_t;
static uint32_t *peripheralmem = (uint32_t *)MAP_FAILED; // mmap'ed peripheral memory
@@ -909,6 +910,9 @@ static int peripheral_map(void)
case RPI_2: // for RPI 3 too
membase += BCM2709_OFFSET;
break;
+ case RPI_4:
+ membase += BCM2711_OFFSET;
+ break;
default:
rtapi_print_msg(RPSPI_ERR, "hm2_rpspi: Platform not supported\n");
return -1;
@@ -1137,6 +1141,9 @@ static platform_t check_platform(void)
case 2: //bcm2837
rv = RPI_2; // peripheral base is same on pi2/3
break;
+ case 3:
+ rv = RPI_4;
+ break;
default:
break;
}
...as RPI4 has yet another iobase than RPI 2 & 3. Don't know if BCM2711 makes sense as a label, I just picked it from the kernel defconfig prefix.
Hopefully this saves someone else some time to get going with this combination.
Again, just first results I have only tested running the default gcode in Axis without anything like stepper drivers connected using the 7i90 template ini/hal. Seems stable at 20.834 MHz using 150mm clip on test wires. No realtime excursions reported.
/svante