diff --git a/testhal/ATSAMA5D2/SPI/Makefile b/testhal/ATSAMA5D2/SPI/Makefile
index 52802f056..75f0754e3 100644
--- a/testhal/ATSAMA5D2/SPI/Makefile
+++ b/testhal/ATSAMA5D2/SPI/Makefile
@@ -223,10 +223,10 @@ CPPWARN = -Wall -Wextra -Wundef
#
# List all user C define here, like -D_DEBUG=1
-UDEFS =
+UDEFS = -DCH_CFG_USE_MMU
# Define ASM defines here
-UADEFS =
+UADEFS = -DCH_CFG_USE_MMU
# List all user directories here
UINCDIR =
diff --git a/testhal/ATSAMA5D2/SPI/debug/SAMA5D2-SPI (Load and Run).launch b/testhal/ATSAMA5D2/SPI/debug/SAMA5D2-SPI (Load and Run).launch
index 8854c23ea..66e94cdbb 100644
--- a/testhal/ATSAMA5D2/SPI/debug/SAMA5D2-SPI (Load and Run).launch
+++ b/testhal/ATSAMA5D2/SPI/debug/SAMA5D2-SPI (Load and Run).launch
@@ -1,55 +1,58 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/testhal/ATSAMA5D2/SPI/debug/SAMA5D2-SPI (bootstrap).launch b/testhal/ATSAMA5D2/SPI/debug/SAMA5D2-SPI (bootstrap).launch
new file mode 100644
index 000000000..e73b49be3
--- /dev/null
+++ b/testhal/ATSAMA5D2/SPI/debug/SAMA5D2-SPI (bootstrap).launch
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/testhal/ATSAMA5D2/SPI/main.c b/testhal/ATSAMA5D2/SPI/main.c
index f2c61f0d8..ed1fd8d89 100644
--- a/testhal/ATSAMA5D2/SPI/main.c
+++ b/testhal/ATSAMA5D2/SPI/main.c
@@ -25,6 +25,12 @@ static virtual_timer_t vt3;
static char txbuf[BUFFER_SIZE] = "0123456789ABCDEF";
static char rxbuf[BUFFER_SIZE];
+static const SerialConfig sdcfg = {
+ 115200,
+ 0,
+ UART_MR_PAR_NO
+};
+
static void led3off(void *p) {
(void)p;
@@ -88,12 +94,12 @@ int main(void) {
/*
* Activates the serial driver 0 using the driver default configuration.
*/
- sdStart(&SD0, NULL);
+ sdStart(&SD1, &sdcfg);
spiStart(&SPID1, &mst_spicfg); /* Setup transfer parameters. */
- /* Redirecting UART0 RX on PB26 and UART0 TX on PB 27. */
- palSetGroupMode(PIOB, PAL_PORT_BIT(26) | PAL_PORT_BIT(27), 0U,
- PAL_SAMA_FUNC_PERIPH_C | PAL_MODE_SECURE);
+ /* Redirecting UART1 RX on PD2 and UART1 TX on PD3. */
+ palSetGroupMode(PIOD, PAL_PORT_BIT(2) | PAL_PORT_BIT(3), 0U,
+ PAL_SAMA_FUNC_PERIPH_A | PAL_MODE_SECURE);
/* Redirecting SPI1 pins. */
palSetGroupMode(PIOD, PAL_PORT_BIT(25) | PAL_PORT_BIT(26) |
@@ -104,12 +110,17 @@ int main(void) {
while (true) {
if(!palReadPad(PIOB, PIOB_USER_PB)) {
+ /* SPI operation in loopback*/
spiExchange(&SPID1, BUFFER_SIZE, &txbuf, &rxbuf);
+
+ /* D-Cache L1 is enabled */
+ cacheInvalidateRegion(&rxbuf, sizeof(rxbuf));
+
if (!memcmp(txbuf, rxbuf, BUFFER_SIZE)){
- chprintf((BaseSequentialStream*)&SD0, "Transfer complete\n\r");
+ chprintf((BaseSequentialStream*)&SD1, "Transfer complete\n\r");
}
else {
- chprintf((BaseSequentialStream*)&SD0, "ERROR: Buffers are not the same!\n\r");
+ chprintf((BaseSequentialStream*)&SD1, "ERROR: Buffers are not the same!\n\r");
}
}
chThdSleepMilliseconds(500);
diff --git a/testhal/ATSAMA5D2/SPI/mcuconf.h b/testhal/ATSAMA5D2/SPI/mcuconf.h
index b59e031d7..80c78dbfd 100644
--- a/testhal/ATSAMA5D2/SPI/mcuconf.h
+++ b/testhal/ATSAMA5D2/SPI/mcuconf.h
@@ -53,16 +53,26 @@
#define SAMA_SPI_FLEXCOM3_DMA_IRQ_PRIORITY 4
#define SAMA_SPI_FLEXCOM4_DMA_IRQ_PRIORITY 4
#define SAMA_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure")
+#define SPI_SELECT_MODE SPI_SELECT_MODE_NONE
+
+/*
+ * SECUMOD driver system settings.
+ */
+#define HAL_USE_SECUMOD FALSE
+
+/*
+ * SDMMC driver system settings.
+ */
+#define HAL_USE_SDMMC FALSE
/*
* SERIAL driver system settings.
*/
-#define SAMA_SERIAL_USE_UART0 TRUE
-#define SAMA_SERIAL_USE_UART1 FALSE
+#define SAMA_SERIAL_USE_UART0 FALSE
+#define SAMA_SERIAL_USE_UART1 TRUE
#define SAMA_SERIAL_USE_UART2 FALSE
#define SAMA_SERIAL_USE_UART3 FALSE
#define SAMA_SERIAL_USE_UART4 FALSE
-#define SAMA_SERIAL_USE_UART5 FALSE
#define SAMA_SERIAL_USE_FLEXCOM0 FALSE
#define SAMA_SERIAL_USE_FLEXCOM1 FALSE
#define SAMA_SERIAL_USE_FLEXCOM2 FALSE
@@ -79,6 +89,13 @@
#define SAMA_SERIAL_FLEXCOM3_IRQ_PRIORITY 4
#define SAMA_SERIAL_FLEXCOM4_IRQ_PRIORITY 4
+/*
+ * ST driver settings.
+ */
+#define SAMA_ST_USE_PIT TRUE
+#define SAMA_ST_USE_TC0 FALSE
+#define SAMA_ST_USE_TC1 FALSE
+
/*
* TC driver system settings.
*/
@@ -123,6 +140,4 @@
#define SAMA_UART_FLEXCOM4_DMA_IRQ_PRIORITY 4
#define SAMA_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure")
-#define SPI_SELECT_MODE SPI_SELECT_MODE_NONE
-
#endif /* MCUCONF_H */