summaryrefslogtreecommitdiff
path: root/bsp/ls2kdev/drivers
diff options
context:
space:
mode:
author马浩然 <[email protected]>2021-01-17 23:33:48 +0800
committerGitHub <[email protected]>2021-01-17 23:33:48 +0800
commit902fe8bd5e78e64e8ae0cd70399387081cd6fe47 (patch)
tree6a615d3015d39f9cd72d4a05dd601bccd7e967cc /bsp/ls2kdev/drivers
parenta18714b04a3f9643b0c40a1cba1b24712537c263 (diff)
Update drv_spi.c
Bug Fixed : clock division cannot been adjusted as expected due to wrong register configuration.
Diffstat (limited to 'bsp/ls2kdev/drivers')
-rw-r--r--bsp/ls2kdev/drivers/drv_spi.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/bsp/ls2kdev/drivers/drv_spi.c b/bsp/ls2kdev/drivers/drv_spi.c
index 3f3ad90802..5a42acbee8 100644
--- a/bsp/ls2kdev/drivers/drv_spi.c
+++ b/bsp/ls2kdev/drivers/drv_spi.c
@@ -6,6 +6,7 @@
* Change Logs:
* Date Author Notes
* 2020-10-28 0xcccccccccccc Initial Version
+ * 2021-01-17 0xcccccccccccc Bug Fixed : clock division cannot been adjusted as expected due to wrong register configuration.
*/
/**
* @addtogroup ls2k
@@ -21,11 +22,11 @@
#ifdef RT_USING_SPI
static void spi_init(uint8_t spre_spr, uint8_t copl, uint8_t cpha)
{
- SET_SPI(SPSR, 0xc0 | (spre_spr & 0b00000011));
+ SET_SPI(SPSR, 0xc0);
SET_SPI(PARAM, 0x40);
SET_SPI(PARAM2, 0x01);
SET_SPI(SPER, (spre_spr & 0b00001100) >> 2);
- SET_SPI(SPCR, 0x50 | copl << 3 | cpha << 2);
+ SET_SPI(SPCR, 0x50 | copl << 3 | cpha << 2 | (spre_spr & 0b00000011));
SET_SPI(SOFTCS, 0xff);
}