Skip to content

Commit aa334b0

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

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

targets/TARGET_NXP/TARGET_LPC11UXX/spi_api.c

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

7777
int FRF = 0; // FRF (frame format) = SPI
7878
uint32_t tmp = obj->spi->CR0;
79-
tmp &= ~(0xFFFF);
79+
tmp &= ~(0x00FF); // Clear DSS, FRF, CPOL and CPHA [7:0]
8080
tmp |= DSS << 0
8181
| FRF << 4
8282
| SPO << 6
@@ -112,7 +112,7 @@ void spi_frequency(spi_t *obj, int hz) {
112112
obj->spi->CPSR = prescaler;
113113

114114
// divider
115-
obj->spi->CR0 &= ~(0xFFFF << 8);
115+
obj->spi->CR0 &= ~(0xFF00); // Clear SCR: Serial clock rate [15:8]
116116
obj->spi->CR0 |= (divider - 1) << 8;
117117
ssp_enable(obj);
118118
return;

0 commit comments

Comments
 (0)