Problems writing by I2C in SL3S4011FHK,125

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Problems writing by I2C in SL3S4011FHK,125

2,249件の閲覧回数
o_garcia
Contributor II

Hi,

I´m working with a SL3S4011FHK,125 TAG and I have some problems when I want to write in a EPC ID memory bank by I2C.

I can read every memory banks by I2C but not Write.  

I try to write by RF in EPC ID memory bank and I write successfully.

 

Could you help me please?

 

ラベル(1)
  • RF

タグ(1)
7 返答(返信)

2,036件の閲覧回数
o_garcia
Contributor II

Hi Dries,

Thank´s for your reply.

First I read the TID Serial number of each Tag by I2C (Addresses 4006h,4007h,4008h,4009h, 400Ah, 400Bh). In this case, I don´t have problems to obtain this Serial number.

As I have verified, the EPC ID is identical in all tags,  but I need different EPC IDs in all tags that I´m going to use. So I want to write TID Serial number in the EPC ID memory bank.

I want to write the TID serial number by I2c in this EPC ID addresses (200Ah,200Bh,200Ch,200Dh,200Eh) but I can´t.

I don´t know why. Is this memory bank probably locked? 

The reading process is always correct but the writing process always fail me. I use the same function to read/write by I2C in other pheripherals.

Settings of i2C:

Cpu frequency: 8Mhz

I2C clock frequency: 400khz

The functions I use are as follow:

uchar SL3S4011_Write (uint uiRegister, uint uiDate)
{
uchar ucResult = FALSE;

/* I2C */
unsigned char messageBuf[5];
unsigned char TWI_targetSlaveAddress;

TWI_targetSlaveAddress = 0x51;

// Send the request-for-data command to the Slave
messageBuf[0] = (TWI_targetSlaveAddress<<TWI_ADR_BITS) | (FALSE<<TWI_READ_BIT); // The first byte must always consit of General Call code or the TWI slave address.
messageBuf[1] = (uchar)(uiRegister >> 8);//Address
messageBuf[2] = (uchar)(uiRegister);
messageBuf[3] = (uchar) (uiDate >> 8);//Date
messageBuf[4] = (uchar)(uiDate);
TWI_Start_Transceiver_With_Data( messageBuf, 5 );


return (ucResult);
}

/****************************************************************************
Call this function to send a prepared message. The first byte must contain the slave address and the
read/write bit. Consecutive bytes contain the data to be sent, or empty locations for data to be read
from the slave. Also include how many bytes that should be sent/read including the address byte.
The function will hold execution (loop) until the TWI_ISR has completed with the previous operation,
then initialize the next operation and return.
****************************************************************************/
void TWI_Start_Transceiver_With_Data( unsigned char *msg, unsigned char msgSize )
{
unsigned char temp;

while ( TWI_Transceiver_Busy() ); // Wait until TWI is ready for next transmission.

TWI_msgSize = msgSize; // Number of data to transmit.
TWI_buf[0] = msg[0]; // Store slave address with R/W setting.
if (!( msg[0] & (TRUE<<TWI_READ_BIT) )) // If it is a write operation, then also copy data.
{
for ( temp = 1; temp < msgSize; temp++ )
TWI_buf[ temp ] = msg[ temp ];
}
TWI_statusReg.all = 0;
TWI_state = TWI_NO_STATE ;
TWCR = (1<<TWEN)| // TWI Interface enabled.
(1<<TWIE)|(1<<TWINT)| // Enable TWI Interupt and clear the flag.
(0<<TWEA)|(1<<TWSTA)|(0<<TWSTO)| // Initiate a START condition.
(0<<TWWC);


}

 

I found this information in other Post of this community:

https://community.nxp.com/thread/464218

I hope your answer.

Oscar.

0 件の賞賛
返信

1,875件の閲覧回数
zacck
Contributor I

Hi Sorry to hijack your question but I am wondering what registers are you using when sending EPCGlobal commands to the chip via 12c?

Commands like

SELECT
QUERY

REQ_RN 

For some reason I can't see how to send commands to the device via i2c, I may be misinterpreting the datasheet somehow, thank you so much!

0 件の賞賛
返信

2,035件の閲覧回数
driesmoors
NXP Employee
NXP Employee

Hi,

Can't readily see an obvious error.

What is the exact behavior? The I2C command finishes successfully, but the memory is not modified? How do you check this? Via I2C, UHF?

Summarizing:

- reading via UHF: OK

- writing via UHF: OK

- reading via I2C: OK

- writing via I2C: problem.

Correct?

Can you verify the data sent over the I2C wires, using a scope or logic analyzer? Have you tried to reduce the speed and transmit at 100kHz?

Best,

0 件の賞賛
返信

2,036件の閲覧回数
o_garcia
Contributor II

Hi Dries,

Thanks again for your reply,.

The Summarizing it is correct. 

When I write for example the value=0x6666 by UHF in 200Ah address, then I check by I2C and by UHF if I get the value of 0x6666. All the process is correct.

First of alI, I have tried writing over i2C at a speed of 100khz but I continue with the same problem.

Then I have connected the oscilloscope to see if the write process by I2c is correct.

In the First Image, I have tried to write by I2C the value 0x6666 in 200Ah address. Watching the oscilloscope signals I think that the write process is not correct.

pastedImage_4.png

In the second image, I have read by I2C the value of the address 200Ah but I get the value 0x0000.

pastedImage_3.png

Could you help me please?

Best regards,

Oscar

0 件の賞賛
返信

2,036件の閲覧回数
driesmoors
NXP Employee
NXP Employee

Hi Oscar,

  • On your first scope plot
    The I2C slave is not providing an ACK (the data line is not pulled low). This may be caused by:
    • The UCode-I2C IC is not correctly powered.
    • The I2C address is wrong - it is hard to see the bits and to compare them with the second scope plot.
    • A UHF field is present: the UCode I2C IC can only serve one interface at a time. Try again without any UHF field in the vicinity.
  • On your second scope plot
    I see two transfers, and this does not correspond to the explanation you provide with them. Can you check your code?
    • The first transmits two bytes to the slave - could be 0x200A
    • The second reads a single byte from the slave: 0x00

I hope this helps!
Best,
Dries.

0 件の賞賛
返信

2,036件の閲覧回数
o_garcia
Contributor II

Hi Dries,

Thank you for your help!!

I have managed to write what I wanted, The error was that I had UHF field in the vicinity.

Best regards,

Oscar

2,036件の閲覧回数
driesmoors
NXP Employee
NXP Employee

Hi,

Can you post an example? What are your I2C settings, what are you trying to write, to which address, and how does your I2C data look like?

Best,
Dries

0 件の賞賛
返信