diff --git a/targets/TARGET_NXP/TARGET_LPC11U6X/spi_api.c b/targets/TARGET_NXP/TARGET_LPC11U6X/spi_api.c index 95c647c74c3..6f78a61cd96 100644 --- a/targets/TARGET_NXP/TARGET_LPC11U6X/spi_api.c +++ b/targets/TARGET_NXP/TARGET_LPC11U6X/spi_api.c @@ -110,7 +110,7 @@ void spi_format(spi_t *obj, int bits, int mode, int slave) { int FRF = 0; // FRF (frame format) = SPI uint32_t tmp = obj->spi->CR0; - tmp &= ~(0xFFFF); + tmp &= ~(0x00FF); // Clear DSS, FRF, CPOL and CPHA [7:0] tmp |= DSS << 0 | FRF << 4 | SPO << 6 @@ -146,7 +146,7 @@ void spi_frequency(spi_t *obj, int hz) { obj->spi->CPSR = prescaler; // divider - obj->spi->CR0 &= ~(0xFFFF << 8); + obj->spi->CR0 &= ~(0xFF00); // Clear SCR: Serial clock rate [15:8] obj->spi->CR0 |= (divider - 1) << 8; ssp_enable(obj); return; diff --git a/targets/TARGET_NXP/TARGET_LPC11UXX/spi_api.c b/targets/TARGET_NXP/TARGET_LPC11UXX/spi_api.c index 024dff60d4b..19d40f2ff36 100644 --- a/targets/TARGET_NXP/TARGET_LPC11UXX/spi_api.c +++ b/targets/TARGET_NXP/TARGET_LPC11UXX/spi_api.c @@ -76,7 +76,7 @@ void spi_format(spi_t *obj, int bits, int mode, int slave) { int FRF = 0; // FRF (frame format) = SPI uint32_t tmp = obj->spi->CR0; - tmp &= ~(0xFFFF); + tmp &= ~(0x00FF); // Clear DSS, FRF, CPOL and CPHA [7:0] tmp |= DSS << 0 | FRF << 4 | SPO << 6 @@ -112,7 +112,7 @@ void spi_frequency(spi_t *obj, int hz) { obj->spi->CPSR = prescaler; // divider - obj->spi->CR0 &= ~(0xFFFF << 8); + obj->spi->CR0 &= ~(0xFF00); // Clear SCR: Serial clock rate [15:8] obj->spi->CR0 |= (divider - 1) << 8; ssp_enable(obj); return; diff --git a/targets/TARGET_NXP/TARGET_LPC11XX_11CXX/spi_api.c b/targets/TARGET_NXP/TARGET_LPC11XX_11CXX/spi_api.c index d8595cb22b6..f7ac3488b02 100644 --- a/targets/TARGET_NXP/TARGET_LPC11XX_11CXX/spi_api.c +++ b/targets/TARGET_NXP/TARGET_LPC11XX_11CXX/spi_api.c @@ -112,7 +112,7 @@ void spi_format(spi_t *obj, int bits, int mode, int slave) { int FRF = 0; // FRF (frame format) = SPI uint32_t tmp = obj->spi->CR0; - tmp &= ~(0xFFFF); + tmp &= ~(0x00FF); // Clear DSS, FRF, CPOL and CPHA [7:0] tmp |= DSS << 0 | FRF << 4 | SPO << 6 @@ -148,7 +148,7 @@ void spi_frequency(spi_t *obj, int hz) { obj->spi->CPSR = prescaler; // divider - obj->spi->CR0 &= ~(0xFFFF << 8); + obj->spi->CR0 &= ~(0xFF00); // Clear SCR: Serial clock rate [15:8] obj->spi->CR0 |= (divider - 1) << 8; ssp_enable(obj); return; diff --git a/targets/TARGET_NXP/TARGET_LPC13XX/spi_api.c b/targets/TARGET_NXP/TARGET_LPC13XX/spi_api.c index 5c36ffece0f..f6243fde4a4 100644 --- a/targets/TARGET_NXP/TARGET_LPC13XX/spi_api.c +++ b/targets/TARGET_NXP/TARGET_LPC13XX/spi_api.c @@ -104,7 +104,7 @@ void spi_format(spi_t *obj, int bits, int mode, int slave) { int FRF = 0; // FRF (frame format) = SPI uint32_t tmp = obj->spi->CR0; - tmp &= ~(0xFFFF); + tmp &= ~(0x00FF); // Clear DSS, FRF, CPOL and CPHA [7:0] tmp |= DSS << 0 | FRF << 4 | SPO << 6 @@ -140,7 +140,7 @@ void spi_frequency(spi_t *obj, int hz) { obj->spi->CPSR = prescaler; // divider - obj->spi->CR0 &= ~(0xFFFF << 8); + obj->spi->CR0 &= ~(0xFF00); // Clear SCR: Serial clock rate [15:8] obj->spi->CR0 |= (divider - 1) << 8; ssp_enable(obj); return; diff --git a/targets/TARGET_NXP/TARGET_LPC176X/spi_api.c b/targets/TARGET_NXP/TARGET_LPC176X/spi_api.c index ba2bde2989d..cc30a264e8a 100644 --- a/targets/TARGET_NXP/TARGET_LPC176X/spi_api.c +++ b/targets/TARGET_NXP/TARGET_LPC176X/spi_api.c @@ -98,7 +98,7 @@ void spi_format(spi_t *obj, int bits, int mode, int slave) { int FRF = 0; // FRF (frame format) = SPI uint32_t tmp = obj->spi->CR0; - tmp &= ~(0xFFFF); + tmp &= ~(0x00FF); // Clear DSS, FRF, CPOL and CPHA [7:0] tmp |= DSS << 0 | FRF << 4 | SPO << 6 @@ -146,7 +146,7 @@ void spi_frequency(spi_t *obj, int hz) { obj->spi->CPSR = prescaler; // divider - obj->spi->CR0 &= ~(0xFFFF << 8); + obj->spi->CR0 &= ~(0xFF00); // Clear SCR: Serial clock rate [15:8] obj->spi->CR0 |= (divider - 1) << 8; ssp_enable(obj); return; diff --git a/targets/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088/spi_api.c b/targets/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088/spi_api.c index 2af13ff55b4..6a71a440461 100644 --- a/targets/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088/spi_api.c +++ b/targets/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088/spi_api.c @@ -118,7 +118,7 @@ void spi_format(spi_t *obj, int bits, int mode, int slave) { int FRF = 0; // FRF (frame format) = SPI uint32_t tmp = obj->spi->CR0; - tmp &= ~(0xFFFF); + tmp &= ~(0x00FF); // Clear DSS, FRF, CPOL and CPHA [7:0] tmp |= DSS << 0 | FRF << 4 | SPO << 6 @@ -153,7 +153,7 @@ void spi_frequency(spi_t *obj, int hz) { obj->spi->CPSR = prescaler; // divider - obj->spi->CR0 &= ~(0xFFFF << 8); + obj->spi->CR0 &= ~(0xFF00); // Clear SCR: Serial clock rate [15:8] obj->spi->CR0 |= (divider - 1) << 8; ssp_enable(obj); return; diff --git a/targets/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088_DM/spi_api.c b/targets/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088_DM/spi_api.c index 5797a501cc2..b6a158b4812 100644 --- a/targets/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088_DM/spi_api.c +++ b/targets/TARGET_NXP/TARGET_LPC408X/TARGET_LPC4088_DM/spi_api.c @@ -98,7 +98,7 @@ void spi_format(spi_t *obj, int bits, int mode, int slave) { int FRF = 0; // FRF (frame format) = SPI uint32_t tmp = obj->spi->CR0; - tmp &= ~(0xFFFF); + tmp &= ~(0x00FF); // Clear DSS, FRF, CPOL and CPHA [7:0] tmp |= DSS << 0 | FRF << 4 | SPO << 6 @@ -133,7 +133,7 @@ void spi_frequency(spi_t *obj, int hz) { obj->spi->CPSR = prescaler; // divider - obj->spi->CR0 &= ~(0xFFFF << 8); + obj->spi->CR0 &= ~(0xFF00); // Clear SCR: Serial clock rate [15:8] obj->spi->CR0 |= (divider - 1) << 8; ssp_enable(obj); return; diff --git a/targets/TARGET_NXP/TARGET_LPC43XX/spi_api.c b/targets/TARGET_NXP/TARGET_LPC43XX/spi_api.c index 03a8049864c..ac30524aef4 100644 --- a/targets/TARGET_NXP/TARGET_LPC43XX/spi_api.c +++ b/targets/TARGET_NXP/TARGET_LPC43XX/spi_api.c @@ -117,7 +117,7 @@ void spi_format(spi_t *obj, int bits, int mode, int slave) { int FRF = 0; // FRF (frame format) = SPI uint32_t tmp = obj->spi->CR0; - tmp &= ~(0xFFFF); + tmp &= ~(0x00FF); // Clear DSS, FRF, CPOL and CPHA [7:0] tmp |= DSS << 0 | FRF << 4 | SPO << 6 @@ -152,7 +152,7 @@ void spi_frequency(spi_t *obj, int hz) { obj->spi->CPSR = prescaler; // divider - obj->spi->CR0 &= ~(0xFFFF << 8); + obj->spi->CR0 &= ~(0xFF00); // Clear SCR: Serial clock rate [15:8] obj->spi->CR0 |= (divider - 1) << 8; ssp_enable(obj); return;