diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2013-06-20 17:39:42 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2013-06-20 17:39:42 -0600 |
commit | d613457ead9cfb4b907ba08c800d7db51084edcd (patch) | |
tree | 9389b39df6984c1d05894bcf4484aee5e76276f7 | |
parent | 39bd870cc0447b7453b690f647ca26eb69ebbfd1 (diff) | |
download | px4-nuttx-d613457ead9cfb4b907ba08c800d7db51084edcd.tar.gz px4-nuttx-d613457ead9cfb4b907ba08c800d7db51084edcd.tar.bz2 px4-nuttx-d613457ead9cfb4b907ba08c800d7db51084edcd.zip |
Fix backward wait condition in KL24Z SPI driver
-rwxr-xr-x | nuttx/arch/arm/src/kl/kl_spi.c | 8 | ||||
-rw-r--r-- | nuttx/arch/arm/src/kl/kl_spi.h | 4 | ||||
-rw-r--r-- | nuttx/configs/freedom-kl25z/README.txt | 36 |
3 files changed, 32 insertions, 16 deletions
diff --git a/nuttx/arch/arm/src/kl/kl_spi.c b/nuttx/arch/arm/src/kl/kl_spi.c index 4573e4a07..b48fcc478 100755 --- a/nuttx/arch/arm/src/kl/kl_spi.c +++ b/nuttx/arch/arm/src/kl/kl_spi.c @@ -488,7 +488,7 @@ static uint16_t spi_send(FAR struct spi_dev_s *dev, uint16_t wd) /* Make sure that the transmit buffer is empty */ - while ((spi_getreg(priv, KL_SPI_S_OFFSET) & SPI_S_SPTEF) != 0); + while ((spi_getreg(priv, KL_SPI_S_OFFSET) & SPI_S_SPTEF) == 0); /* Write the data to transmitted to the SPI Data Register */ @@ -555,7 +555,7 @@ static void spi_exchange(FAR struct spi_dev_s *dev, FAR const void *txbuffer, * to the serializer. */ - while ((spi_getreg(priv, KL_SPI_S_OFFSET) & SPI_S_SPTEF) != 0); + while ((spi_getreg(priv, KL_SPI_S_OFFSET) & SPI_S_SPTEF) == 0); /* Write the data to transmitted to the Transmit Data Register (TDR) */ @@ -675,7 +675,7 @@ FAR struct spi_dev_s *up_spiinitialize(int port) /* Enable clocking */ - regval = getreg32(KL_SIM_SCGC4); + regval = getreg32(KL_SIM_SCGC4); regval |= SIM_SCGC4_SPI0; putreg32(regval, KL_SIM_SCGC4); } @@ -694,7 +694,7 @@ FAR struct spi_dev_s *up_spiinitialize(int port) /* Enable clocking */ - regval = getreg32(KL_SIM_SCGC4); + regval = getreg32(KL_SIM_SCGC4); regval |= SIM_SCGC4_SPI1; putreg32(regval, KL_SIM_SCGC4); } diff --git a/nuttx/arch/arm/src/kl/kl_spi.h b/nuttx/arch/arm/src/kl/kl_spi.h index 659ee8f5f..7b5e56d4b 100644 --- a/nuttx/arch/arm/src/kl/kl_spi.h +++ b/nuttx/arch/arm/src/kl/kl_spi.h @@ -66,7 +66,7 @@ extern "C" { * Public Function Prototypes ************************************************************************************/ -/**************************************************************************** +/************************************************************************************ * Name: up_spiinitialize * * Description: @@ -78,7 +78,7 @@ extern "C" { * Returned Value: * Valid SPI device structure reference on succcess; a NULL on failure * - ****************************************************************************/ + ************************************************************************************/ struct spi_dev_s; FAR struct spi_dev_s *up_spiinitialize(int port); diff --git a/nuttx/configs/freedom-kl25z/README.txt b/nuttx/configs/freedom-kl25z/README.txt index fa1d3a6be..68fb475b9 100644 --- a/nuttx/configs/freedom-kl25z/README.txt +++ b/nuttx/configs/freedom-kl25z/README.txt @@ -116,7 +116,7 @@ is configured to work with the OpenSDA USB CDC/ACM port: Pin 27 PTA1/TSI0_CH2/UART0_RX/FTM2_CH0 UART1_RX_TGTMCU and D0 (PTA1) Pin 28 PTA2/TSI0_CH3/UART0_TX/FTM2_CH1 UART1_TX_TGTMCU and D1 (PTA2) -But the UART Tx/Rx signals are also available on J1: +But the UART0 Tx/Rx signals are also available on J1: ---------------- --------- UART0 SIGNAL J1 pin @@ -124,6 +124,8 @@ But the UART Tx/Rx signals are also available on J1: UART0_RX (PTA1) J1, pin 2 UART0_TX (PTA2) J1, pin 4 +Ground is available on J2 pin 14. 3.3V is available on J3 and J4. + mbed ==== @@ -306,16 +308,25 @@ Where <subdir> is one of the following: CONFIG_ARMV6M_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery for Windows 3. Serial Console. A serial console is required to see the OS test - output. The serial console is configured on UART1 which is available - on JP5: + output. The serial console is configured on UART0 which is available + on J1: + + ---------------- --------- + UART0 SIGNAL J1 pin + ---------------- --------- + UART0_RX (PTA1) J1, pin 2 + UART0_TX (PTA2) J1, pin 4 - UART1 RX signal (RXD1) is on PB.4, pin 8, and - UART1 TX signal (TXD1) is on PB.5, pin 9. + Ground is available on J2 pin 14. 3.3V is available on J3 and J4. + + It is possible to configure NSH to use a USB serial console instead + of an RS-232 serial console. However, that configuration has not + been impelmented as of this writing. nsh: --- Configures the NuttShell (nsh) located at apps/examples/nsh. The - Configuration enables the serial interfaces on UART1. Support for + Configuration enables the serial interface on UART0. Support for builtin applications is disabled. NOTES: @@ -338,11 +349,16 @@ Where <subdir> is one of the following: CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery for Windows 3. Serial Console. A serial console is necessary to interrupt with - NSH. The serial console is configured on UART1 which is available - on JP5: + NSH. The serial console is configured on UART0 which is available + on J1: + + ---------------- --------- + UART0 SIGNAL J1 pin + ---------------- --------- + UART0_RX (PTA1) J1, pin 2 + UART0_TX (PTA2) J1, pin 4 - UART1 RX signal (RXD1) is on PB.4, pin 8, and - UART1 TX signal (TXD1) is on PB.5, pin 9. + Ground is available on J2 pin 14. 3.3V is available on J3 and J4. It is possible to configure NSH to use a USB serial console instead of an RS-232 serial console. However, that configuration has not |