Missing the last bit when read internal registers of the SC18IS600

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

Missing the last bit when read internal registers of the SC18IS600

2,407 Views
idanu357
Contributor II

Hello,

My problem is when reading the internal register values of the SC18IS600 the value of the last bit is always "0"

For example, I'm writing 0xFF to the IOConfig register but when i read the value its 0xFE or writing to the same register 0X01 reading 0x00. (same with IOstate or I2Cclock)

To verify that the problem is in the read function and not the write function i set GPIO0 to low-> high-> low and i can see it changes.

I've tried using the read command with and without the dummy byte and using full and half duplex, changing **bleep** frequency, and the SPI configuration register with no change of the output.

SPI commands example to set IOconfig to 0xFF:

0x2001FF

SPI commands example to read IOconfig with dummy byte in full duplex:

0x210000

Using:

FTDI: FT4232HL

SPI mode:3

Clock frequency:100Khz

No issues with other SPI devices on the board.

Best regards,

Idan.

0 Kudos
9 Replies

2,402 Views
JozefKozon
NXP TechSupport
NXP TechSupport

Hello Idan,

please note, that the last bit in the register is a read/write R/W bit. This bit must be different for writing and different for reading. 

JozefKozon_0-1663237559813.png

I presume the last bit for writing must be set to 1, you mentioned, you are writing 0xFF=0b1111 1111 and reading 0xFE=0b1111 1110. Please try to write first 0x0F=0b0000 1111 and second 0xFE=0b1111 1110. After that please read the register. You should read 0x0E=0b0000 1110, because the second writing should not change the higher four bits to 1.

With Best Regards,

Jozef

0 Kudos

2,395 Views
idanu357
Contributor II

Hello Jozef and thank you for your replay.

Your answer got me a little confused, if im reading / writing the IOConfig register i should be able to read 8 bits or 1 byte from his address since its internal register.

I did what you asked but i still get 0xEF.

Its the same for the I2Cclock register, when reading the default value from the register im getting 0x18 while the I2C clock is  97 kHz.

The column you marked is for the type of the register not a bit.

 

 

0 Kudos

2,388 Views
JozefKozon
NXP TechSupport
NXP TechSupport

Hello Idan,

thank you for the test you conducted. My conclusion was incorrect. I apologize for that. Could you please confirm, that you read the internal register according the procedure in the section 6.5.8 in the SC18IS600 datasheet? Could you please provide a scope of the register reading? Either from a logic analyzer or from an oscilloscope. 

JozefKozon_0-1663306425274.png

With Best Regards,

Jozef

0 Kudos

2,384 Views
idanu357
Contributor II

Hello,

Bellow is an image of the transaction.

The datasheet is a bit misleading I hope you help me understand this:

1.What is the "Register data" after the register address, is that the data the sent back from the  SC18IS600 ?

2. What is the Dummy byte ? do I really need it ?

My MOSI lines are 0x2100 to read the IOConfig in half duplex or 0x210000 in full duplex

 

Reading SPI lines:

Without the dummy byte reading I2CClock register:

scrprint (4).jpg

 

 

With dummy byte reading the IOConfig register.

scrprint (5).jpg

0 Kudos

2,375 Views
JozefKozon
NXP TechSupport
NXP TechSupport

Hello Idan,

you are very welcome. And thank you for the scopes. Both look ok to me. 

1.What is the "Register data" after the register address, is that the data the sent back from the  SC18IS600 ?

[A] The byte in the "Register data" is the content of the register, which address you enter in the second byte. After the command byte.

2. What is the Dummy byte ? do I really need it ?

[A] Yes, you need the Dummy byte. It gives time to SC18IS600 to send the Register data to the MISO line.

JozefKozon_0-1663519529761.png

In the first scope, you have the Dummy byte. 

In the second scope, you have actually two dummy bytes and two Data bytes. Each on the MISO line each below one dummy byte.

Please check the pictures attached.

 

With Best Regards,

Jozef

2,350 Views
idanu357
Contributor II

Thanks Jozef,

I can see that the SC18IS600 is returning the right data, but for some reason the last bit is missing when i read it via the FTDI chip(USB to SPI).

The data in the code is different from the scope im getting 0x02 instead of 0x03 or 0x18 instead of 0x19 and its consistent for every byte no matter how many bytes im reading from the SPI.

If you can see any problem in the scopes(?) i will continue to investigate the code or FTDI driver.

0 Kudos

2,344 Views
JozefKozon
NXP TechSupport
NXP TechSupport

Hello Idan,

you are very welcome. 

I do not see anything wrong in the scopes. There must be something incorrect in the code or in the FTDI driver as you mentioned.

With Best Regards,

Jozef

0 Kudos

2,189 Views
idanu357
Contributor II

Hello Jozef,

Just wanted to update you that apparently the problem was in the FTDI chip that doesn't support SPI mode 1 and mode 3.

FTDI Application Note  

Thank you for all your help, your effort was much appreciated.

0 Kudos

2,150 Views
JozefKozon
NXP TechSupport
NXP TechSupport

Hello Idan,

you are very welcome and thank you for letting me know. I am glad, that you have found the reason of the issue.

With Best Regards,

Jozef

0 Kudos