Skip to content

Commit db2da2e

Browse files
committed
[HAL LPC11xx_11Cxx] Fix mask bits for SPI clock rate
1 parent aa334b0 commit db2da2e

File tree

1 file changed

+2
-2
lines changed
  • targets/TARGET_NXP/TARGET_LPC11XX_11CXX

1 file changed

+2
-2
lines changed

targets/TARGET_NXP/TARGET_LPC11XX_11CXX/spi_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void spi_format(spi_t *obj, int bits, int mode, int slave) {
112112

113113
int FRF = 0; // FRF (frame format) = SPI
114114
uint32_t tmp = obj->spi->CR0;
115-
tmp &= ~(0xFFFF);
115+
tmp &= ~(0x00FF); // Clear DSS, FRF, CPOL and CPHA [7:0]
116116
tmp |= DSS << 0
117117
| FRF << 4
118118
| SPO << 6
@@ -148,7 +148,7 @@ void spi_frequency(spi_t *obj, int hz) {
148148
obj->spi->CPSR = prescaler;
149149

150150
// divider
151-
obj->spi->CR0 &= ~(0xFFFF << 8);
151+
obj->spi->CR0 &= ~(0xFF00); // Clear SCR: Serial clock rate [15:8]
152152
obj->spi->CR0 |= (divider - 1) << 8;
153153
ssp_enable(obj);
154154
return;

0 commit comments

Comments
 (0)