SC18IS606 - reading back issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SC18IS606 - reading back issue

49 Views
johnpeter
Contributor II

Hello,

We have I2C to SPI converter SC18IS606 manufactured by NXP. We are using Raspberry Pi to write and read data to SC18IS606 through I2C. The device SC18IS606 is shown listed in the Raspberry Pi OS terminal and is detected through “i2cdetect -y 1” command in the terminal with correct address.

As a simple test, we tried write operation (set/clear) to the GPIO 0 to 2 and make them toggle in the loop with some delay in between. This part is working. 

But when we read back from the SC18IS606, it reads 0x80 instead 0x00.

Latter we tied the pins MISO and MOSI together making SPI loop back using a jumper wire. We are sending patterns 0x00 through 0x07 to SPI. The read back data we got is 0x80 through 0x87.

The MSB is always 1 when we read back SPI in the loop back test.

We have tested two SC18IS606 chips which we bought from Mouser and we got the same result.  

Any idea what could be the issue ? How to fix ? 

 

0 Kudos
Reply
1 Reply

7 Views
RafaR
NXP Employee
NXP Employee

Hello johnpeter

Good day!

1.- Please check the ORDER bit

The SC18IS606 SPI configuration register contains an ORDER bit:

  • ORDER = 0 → MSB first (default)
  • ORDER = 1 → LSB first

If the SC18IS606 is configured for LSB-first, but your software interprets the received byte as MSB-first, patterns can appear shifted and may look like the MSB is always set.

Could you verify what value you are writing with the F0h Configure SPI Interface command?

 

2.- are you reading the buffer correctly?

The SC18IS606 does not immediately return GPIO or SPI data after the command. The sequence is:

  1. Send GPIO Read (F5h) or SPI transaction.
  2. Wait for completion (poll device or use INT).
  3. Perform an I²C read of the buffer.

For SPI operations, the received MISO data is stored in the internal buffer and must then be read back through an I²C read transaction.

A protocol error when reading the buffer (for example treating the address byte as data, or reading one bit offset) could produce the exact "+0x80"

I hope this information has helped you, please let me know if you need help with anything else.

Have a great day and best of luck.

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2404257%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ESC18IS606%20-%20reading%20back%20issue%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2404257%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3EWe%20have%20I2C%20to%20SPI%20converter%20SC18IS606%20manufactured%20by%20NXP.%20We%20are%20using%20Raspberry%20Pi%20to%20write%20and%20read%20data%20to%20SC18IS606%20through%20I2C.%20The%20device%20SC18IS606%20is%20shown%20listed%20in%20the%20Raspberry%20Pi%20OS%20terminal%20and%20is%20detected%20through%20%E2%80%9Ci2cdetect%20-y%201%E2%80%9D%20command%20in%20the%20terminal%20with%20correct%20address.%3C%2FP%3E%3CP%3EAs%20a%20simple%20test%2C%20we%20tried%20write%20operation%20(set%2Fclear)%20to%20the%20GPIO%200%20to%202%20and%20make%20them%20toggle%20in%20the%20loop%20with%20some%20delay%20in%20between.%20This%20part%20is%20working.%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20when%20we%20read%20back%20from%20the%20SC18IS606%2C%20it%20reads%200x80%20instead%200x00.%3C%2FP%3E%3CP%3ELatter%20we%20tied%20the%20pins%20MISO%20and%20MOSI%20together%20making%20SPI%20loop%20back%20using%20a%20jumper%20wire.%20We%20are%20sending%20patterns%200x00%20through%200x07%20to%20SPI.%20The%20read%20back%20data%20we%20got%20is%200x80%20through%200x87.%3C%2FP%3E%3CP%3EThe%20MSB%20is%20always%201%20when%20we%20read%20back%20SPI%20in%20the%20loop%20back%20test.%3C%2FP%3E%3CP%3EWe%20have%20tested%20two%20SC18IS606%20chips%20which%20we%20bought%20from%20Mouser%20and%20we%20got%20the%20same%20result.%20%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20idea%20what%20could%20be%20the%20issue%20%3F%20How%20to%20fix%20%3F%26nbsp%3B%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2404650%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20SC18IS606%20-%20reading%20back%20issue%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2404650%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20johnpeter%3C%2FP%3E%0A%3CP%3EGood%20day!%3C%2FP%3E%0A%3CP%3E1.-%20Please%20check%20the%20ORDER%20bit%3C%2FP%3E%0A%3CP%3EThe%20SC18IS606%20SPI%20configuration%20register%20contains%20an%20ORDER%20bit%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EORDER%20%3D%200%20%E2%86%92%20MSB%20first%20(default)%3C%2FLI%3E%0A%3CLI%3EORDER%20%3D%201%20%E2%86%92%20LSB%20first%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EIf%20the%20SC18IS606%20is%20configured%20for%20LSB-first%2C%20but%20your%20software%20interprets%20the%20received%20byte%20as%20MSB-first%2C%20patterns%20can%20appear%20shifted%20and%20may%20look%20like%20the%20MSB%20is%20always%20set.%3C%2FP%3E%0A%3CP%3ECould%20you%20verify%20what%20value%20you%20are%20writing%20with%20the%20F0h%20Configure%20SPI%20Interface%20command%3F%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3E2.-%20are%20you%20reading%20the%20buffer%20correctly%3F%3C%2FP%3E%0A%3CP%3EThe%20SC18IS606%20does%20not%20immediately%20return%20GPIO%20or%20SPI%20data%20after%20the%20command.%20The%20sequence%20is%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ESend%20GPIO%20Read%20(F5h)%20or%20SPI%20transaction.%3C%2FLI%3E%0A%3CLI%3EWait%20for%20completion%20(poll%20device%20or%20use%20INT).%3C%2FLI%3E%0A%3CLI%3EPerform%20an%20I%C2%B2C%20read%20of%20the%20buffer.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EFor%20SPI%20operations%2C%20the%20received%20MISO%20data%20is%20stored%20in%20the%20internal%20buffer%20and%20must%20then%20be%20read%20back%20through%20an%20I%C2%B2C%20read%20transaction.%3C%2FP%3E%0A%3CP%3EA%20protocol%20error%20when%20reading%20the%20buffer%20(for%20example%20treating%20the%20address%20byte%20as%20data%2C%20or%20reading%20one%20bit%20offset)%20could%20produce%20the%20exact%20%22%2B0x80%22%3C%2FP%3E%0A%3CP%3EI%20hope%20this%20information%20has%20helped%20you%2C%20please%20let%20me%20know%20if%20you%20need%20help%20with%20anything%20else.%3C%2FP%3E%0A%3CP%3EHave%20a%20great%20day%20and%20best%20of%20luck.%3C%2FP%3E%3C%2FLINGO-BODY%3E