diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2018-01-04 11:13:44 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2018-01-04 11:13:44 +0000 |
commit | c2994bdb33024b71f3ac0b4283994715ce6eb563 (patch) | |
tree | 34f26281efec0dd928589b61664b1907800bb644 | |
parent | ccbf09f1a2abad73c81e5e059b7d3f6d370e3293 (diff) | |
download | ChibiOS-c2994bdb33024b71f3ac0b4283994715ce6eb563.tar.gz ChibiOS-c2994bdb33024b71f3ac0b4283994715ce6eb563.tar.bz2 ChibiOS-c2994bdb33024b71f3ac0b4283994715ce6eb563.zip |
Various fixes, H7 SPI does not work yet.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11220 35acf78f-673a-0410-8e92-d51de3d6d3f4
4 files changed, 12 insertions, 15 deletions
diff --git a/os/common/startup/ARMCMx/compilers/GCC/ld/STM32H743xI.ld b/os/common/startup/ARMCMx/compilers/GCC/ld/STM32H743xI.ld index 56e1d29ae..a7de36fd0 100755 --- a/os/common/startup/ARMCMx/compilers/GCC/ld/STM32H743xI.ld +++ b/os/common/startup/ARMCMx/compilers/GCC/ld/STM32H743xI.ld @@ -82,7 +82,7 @@ REGION_ALIAS("DATA_RAM", ram0); REGION_ALIAS("DATA_RAM_LMA", flash0);
/* RAM region to be used for BSS segment.*/
-REGION_ALIAS("BSS_RAM", ram3);
+REGION_ALIAS("BSS_RAM", ram0);
/* RAM region to be used for the default heap.*/
REGION_ALIAS("HEAP_RAM", ram0);
diff --git a/os/hal/ports/STM32/LLD/SPIv3/hal_spi_lld.c b/os/hal/ports/STM32/LLD/SPIv3/hal_spi_lld.c index 936537337..71dd11702 100644 --- a/os/hal/ports/STM32/LLD/SPIv3/hal_spi_lld.c +++ b/os/hal/ports/STM32/LLD/SPIv3/hal_spi_lld.c @@ -525,6 +525,7 @@ void spi_lld_start(SPIDriver *spip) { /* Configuration-specific DMA setup.*/
dsize = (spip->config->cfg2 & SPI_CFG1_DSIZE_Msk) + 1U;
cfg1 = spip->config->cfg1 | SPI_CFG1_RXDMAEN | SPI_CFG1_TXDMAEN;
+ cfg1 &= ~SPI_CFG1_FTHLV_Msk;
if (dsize <= 8U) {
/* Frame width is between 4 and 8 bits.*/
spip->rxdmamode = (spip->rxdmamode & ~STM32_DMA_CR_SIZE_MASK) |
@@ -561,7 +562,7 @@ void spi_lld_start(SPIDriver *spip) { spip->spi->CR1 = SPI_CR1_MASRX;
spip->spi->CR2 = 0U;
spip->spi->CFG1 = cfg1;
- spip->spi->CFG2 = spip->config->cfg2 | SPI_CFG2_MASTER;
+ spip->spi->CFG2 = (spip->config->cfg2 | SPI_CFG2_MASTER) & ~SPI_CFG2_COMM_Msk;
spip->spi->IER = SPI_IER_OVRIE;
spip->spi->IFCR = 0xFFFFFFFFU;
spip->spi->CR1 |= SPI_CR1_SPE;
diff --git a/testhal/STM32/multi/SPI/cfg-stm32h743_nucleo144/portab.c b/testhal/STM32/multi/SPI/cfg-stm32h743_nucleo144/portab.c index 96a86a2ad..1a7538f77 100644 --- a/testhal/STM32/multi/SPI/cfg-stm32h743_nucleo144/portab.c +++ b/testhal/STM32/multi/SPI/cfg-stm32h743_nucleo144/portab.c @@ -41,7 +41,7 @@ const SPIConfig hs_spicfg = { NULL,
GPIOB,
12,
- SPI_CFG1_MBR_DIV8,
+ SPI_CFG1_MBR_DIV8 | SPI_CFG1_DSIZE_VALUE(7),
0
};
@@ -52,7 +52,7 @@ const SPIConfig ls_spicfg = { NULL,
GPIOB,
12,
- SPI_CFG1_MBR_DIV128,
+ SPI_CFG1_MBR_DIV128 | SPI_CFG1_DSIZE_VALUE(7),
0
};
@@ -75,17 +75,13 @@ const SPIConfig ls_spicfg = { void portab_setup(void) {
/*
- * SPI2 I/O pins setup.
+ * SPI1 I/O pins setup.
*/
- palSetPadMode(GPIOB, 13, PAL_MODE_ALTERNATE(5) |
- PAL_STM32_OSPEED_HIGHEST); /* New SCK. */
- palSetPadMode(GPIOB, 14, PAL_MODE_ALTERNATE(5) |
- PAL_STM32_OSPEED_HIGHEST); /* New MISO. */
- palSetPadMode(GPIOB, 15, PAL_MODE_ALTERNATE(5) |
- PAL_STM32_OSPEED_HIGHEST); /* New MOSI. */
- palSetPadMode(GPIOB, 12, PAL_MODE_OUTPUT_PUSHPULL |
- PAL_STM32_OSPEED_HIGHEST); /* New CS. */
- palSetPad(GPIOB, 12);
+ palSetLineMode(LINE_SPI1_SCK, PAL_MODE_ALTERNATE(5) | PAL_STM32_OSPEED_HIGHEST);
+ palSetLineMode(LINE_SPI1_MISO, PAL_MODE_ALTERNATE(5) | PAL_STM32_OSPEED_HIGHEST);
+ palSetLineMode(LINE_SPI1_MOSI, PAL_MODE_ALTERNATE(5) | PAL_STM32_OSPEED_HIGHEST);
+ palSetLineMode(LINE_SPI3_NSS, PAL_MODE_OUTPUT_PUSHPULL | PAL_STM32_OSPEED_HIGHEST);
+ palSetLine(LINE_SPI3_NSS);
}
/** @} */
diff --git a/testhal/STM32/multi/SPI/cfg-stm32h743_nucleo144/portab.h b/testhal/STM32/multi/SPI/cfg-stm32h743_nucleo144/portab.h index 882670b1d..901638a7f 100644 --- a/testhal/STM32/multi/SPI/cfg-stm32h743_nucleo144/portab.h +++ b/testhal/STM32/multi/SPI/cfg-stm32h743_nucleo144/portab.h @@ -35,7 +35,7 @@ #define PORTAB_LED_ON PAL_HIGH
#define PORTAB_LINE_BUTTON LINE_BUTTON
#define PORTAB_BUTTON_PRESSED PAL_HIGH
-#define PORTAB_SPI1 SPID2
+#define PORTAB_SPI1 SPID1
/*===========================================================================*/
/* Module pre-compile time settings. */
|