summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-06-18 12:16:52 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-06-18 12:16:52 -0600
commit0ed63e23493fe94f59f0f4b27720efc69a17d8b7 (patch)
tree331b6d731abfae1a9dbbdfb0ef75b7825589015a
parent9143d0ffcf1bb691480c6657651fc06c7b027a5c (diff)
downloadnuttx-0ed63e23493fe94f59f0f4b27720efc69a17d8b7.tar.gz
nuttx-0ed63e23493fe94f59f0f4b27720efc69a17d8b7.tar.bz2
nuttx-0ed63e23493fe94f59f0f4b27720efc69a17d8b7.zip
Fix test of NULL pointer in the SAM3/4 SPI driver
-rw-r--r--nuttx/ChangeLog3
-rw-r--r--nuttx/arch/arm/src/sam34/sam_spi.c11
-rw-r--r--nuttx/configs/sam3u-ek/README.txt4
-rw-r--r--nuttx/configs/sam4l-xplained/README.txt13
4 files changed, 19 insertions, 12 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index 8cd045ec6..df2cb3f41 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -5004,3 +5004,6 @@
definitions from Alan Carvalho de Assis (2013-6-18).
* configs/freedom-kl25z/src/kl_tsi.c: Example TSI driver for the
Freedom KL25Z board from Alan Carvalho de Assis (2013-6-18).
+ * arch/arm/src/sam34/sam_spi.c: Correct an incorrect pointer test.
+ Was checking if the wrong pointer was NULL (2013-6-18).
+
diff --git a/nuttx/arch/arm/src/sam34/sam_spi.c b/nuttx/arch/arm/src/sam34/sam_spi.c
index 7582e9495..716cebb37 100644
--- a/nuttx/arch/arm/src/sam34/sam_spi.c
+++ b/nuttx/arch/arm/src/sam34/sam_spi.c
@@ -758,7 +758,7 @@ static void spi_exchange(FAR struct spi_dev_s *dev,
{
/* Get the data to send (0xff if there is no data source) */
- if (rxptr)
+ if (txptr)
{
data = (uint32_t)*txptr++;
}
@@ -790,11 +790,16 @@ static void spi_exchange(FAR struct spi_dev_s *dev,
putreg32(data, SAM_SPI_TDR);
- /* Wait for the read data to be available in the RDR */
+ /* Wait for the read data to be available in the RDR.
+ * TODO: Data transfer rates would be improved using the RX FIFO
+ * (and also DMA)
+ */
while ((getreg32(SAM_SPI_SR) & SPI_INT_RDRF) == 0);
- /* Read the received data from the SPI Data Register */
+ /* Read the received data from the SPI Data Register..
+ * TODO: The following only works if nbits <= 8.
+ */
data = getreg32(SAM_SPI_RDR);
if (rxptr)
diff --git a/nuttx/configs/sam3u-ek/README.txt b/nuttx/configs/sam3u-ek/README.txt
index 4bb8caa2e..5c673f6b1 100644
--- a/nuttx/configs/sam3u-ek/README.txt
+++ b/nuttx/configs/sam3u-ek/README.txt
@@ -583,8 +583,8 @@ Configuration sub-directories
CONFIG_ADS7843E_SPIDEV=2 : Use SPI CS 2 for communication
CONFIG_ADS7843E_SPIMODE=0 : Use SPI mode 0
CONFIG_ADS7843E_FREQUENCY=1000000 : SPI BAUD 1MHz
- CONFIG_ADS7843E_THRESHX=39 : These will probably need to be tuned
- CONFIG_ADS7843E_THRESHY=51
+ CONFIG_ADS7843E_THRESHX=51 : These will probably need to be tuned
+ CONFIG_ADS7843E_THRESHY=39
System Type -> Peripherals:
CONFIG_SAM34_SPI=y : Enable support for SPI
diff --git a/nuttx/configs/sam4l-xplained/README.txt b/nuttx/configs/sam4l-xplained/README.txt
index bb7ffa71a..1525a94e0 100644
--- a/nuttx/configs/sam4l-xplained/README.txt
+++ b/nuttx/configs/sam4l-xplained/README.txt
@@ -739,18 +739,17 @@ Configuration sub-directories
an 'unsigned long int'. If this error occurs, then you may need to
toggle the value of CONFIG_CXX_NEWLONG.
- STATUS: As of 2013-6-18, the microSD slot on the I/O1 is marginally
- functional but needs more TLC. It seems to behave poorly when
- debug output is enabled -- know idea why. And writing to the SD card
- does not work. Here is some example of the bad write behavior:
+ STATUS: As of 2013-6-18, this configuration appears completely
+ functional. Testing, however, has been very light. Example:
NuttShell (NSH) NuttX-6.28
nsh> mount -t vfat /dev/mmcsd0 /mnt/stuff
nsh> ls /mnt/stuff
/mnt/stuff:
- sharmanto.txt
- nsh> cat /mnt/stuff/sharmanto.txt
- Hi, from Sharmanto
nsh> echo "This is a test" >/mnt/stuff/atest.txt
nsh> ls /mnt/stuff
/mnt/stuff:
+ atest.txt
+ nsh> cat /mnt/stuff/atest.txt
+ This is a test
+ nsh>