I’m trying to use the hardware SPI on the SolderCore board using the "SPI-DEVICE" driver. Writes are performed correctly, but reads return an empty string (I would expect a number). For Example:
>10 INSTALL "SPI-DEVICE" USING CORE.D10 AS MPU ' for select
>20 MPU.SPEED = 1000000 ' 1 MHz
>30 SPI MPU WRITE 0xff READ 2 TO D 'Read 2 bytes into D
>40 PRINT D
>50 END
>
>run
>
The following pins are used. The the correct output waveforms are produced on the output pins.
D10 CS
D11 SPI MOSI
D12 SPI MISO
D13 SPI SCK
I have tried connecting the SPI MISO to 0v, +3.3v, and left floating. All these configurations return the same result.
I have tried performing the read without the write:
10 INSTALL "SPI-DEVICE" USING CORE.D10 AS MPU ' for select
20 MPU.SPEED = 1000000 ' 1 MHz
30 SPI MPU READ 2 TO D 'Read 2 bytes into D
40 PRINT D
50 END
>run
>
I have tried running the program in calculator mode.
>INSTALL "SPI-DEVICE" USING CORE.D10 AS MPU ' for select
>MPU.SPEED = 1000000 ' 1 MHz
>SPI MPU WRITE 0xff READ 2 TO D 'Read 2 bytes into D
>PRINT D
Converting D to a number returns a NaN error as if D is a blank string.
>PRINT VAL D
nan
>PRINT VAL ""
nan
I have tried using the SenseCore board:
>10 INSTALL "SOLDERCORE-SENSECORE ADDR=0x42" AS SENSECORE
>20 ' Install a generic SPI device. We're using SenseCore slot D
>40 INSTALL "SPI-DEVICE" USING SENSECORE.D AS MPU
>50 MPU.SPEED = 1000000 ' 1 MHz
>60 SPI MPU WRITE 0xff READ 2 TO D 'Read 2 bytes into D
>70 PRINT D
>80 END
>run
>
I have tried reverting back from firmware version 1.3.5 to 1.0.0, a second soldercore board, different clock speeds, different SeXI sites on the SenseCore, Number of read bytes (2, 10, 100, 1000), Variable names for the read bytes to be deposited in etc (From D to DOP etc). The result is always the same? Has anyone else had similar problems?
I have tried using the SenseCore board:>10 INSTALL "SOLDERCORE-SENSECORE ADDR=0x42" AS SENSECORE>20 ' Install a generic SPI device. We're using SenseCore slot D>40 INSTALL "SPI-DEVICE" USING SENSECORE.D AS MPU>50 MPU.SPEED = 1000000 ' 1 MHz>60 SPI MPU WRITE 0xff READ 2 TO D 'Read 2 bytes into D>70 PRINT D>80 END>run>I have tried reverting back from firmware version 1.3.5 to 1.0.0, a second soldercore board, different clock speeds, different SeXI sites on the SenseCore, Number of read bytes (2, 10, 100, 1000), Variable names for the read bytes to be deposited in etc (From D to DOP etc). The result is always the same? Has anyone else had similar problems?
>10 INSTALL "SPI-DEVICE" USING CORE.D10 AS MPU ' for select
>20 MPU.SPEED = 1000000 ' 1 MHz
>30 SPI MPU WRITE 0xff READ 2 TO D 'Read 2 bytes into D
>40 PRINT HEX EXPAND D
>50 END
>run
["00", "00"] -When MISO connected to 0V
>run
["FF", "FF"] -When MISO connected to +3.3V