This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/TRF7970A: not able to get UID or interrupts from TRF7970A while using spi and ti-rtos.

Part Number: TRF7970A

Tool/software: TI-RTOS

hi,

i have problem reading UID/getting interrupts from TRF7970A after sending commands through SPI .

i am using two threads in my program.one thread is used to read data/command from UART and to send the same received Command/data to another thread using MAILBOX.

thread 2 is used to send receive commands/data from TFR7970 using SPI and also send back the uid or data present in tags to UART thread via the same MAILBOX.

the problem here i see is: 

1.i am reading and successfully sent the UID back to UART. while debugging the code with below spi code.

void SPI_directCommand( uint8_t command )
{
SPI_Transaction masterTransaction;
bool transferOK;

// set Address/Command Word Bit Distribution to command
command = (0x80 | command); // command
command = (0x9f & command); // command code

masterTransaction.count = 1;
masterTransaction.txBuf = ( Ptr )&command;
masterTransaction.rxBuf = NULL;

GPIO_write(CC2640R2_LAUNCHXL_GPIO_SPI_CS, 0);

transferOK = SPI_transfer( masterSpi, &masterTransaction );
while(false == bSpiComplete);
bSpiComplete = false;
GPIO_write(CC2640R2_LAUNCHXL_GPIO_SPI_CS, 1); //Stop SPI Mode
if( !transferOK )
{
System_printf("Unsuccessful master SPI_directCommand transfer\n\n");
System_flush();
}
else
{
System_printf("Successful master SPI transfer\n\n");
System_flush();
}
}

void SPI_readSingle(uint8_t *pbuf, uint8_t reg)
{
SPI_Transaction masterTransaction;
uint8_t DummyByte[2];
bool transferOK;
volatile uint8_t x;
uint8_t WriteData[3];

// Address/Command Word Bit Distribution
// address, write, single (fist 3 bits = 0)
reg = (0x1f & reg); // register address
reg = (0x40 | reg); // address, read, single

WriteData[0] = reg;//address
WriteData[1] = 0xff;//dummy byte to get the data out from slave

masterTransaction.count = 2;
masterTransaction.txBuf = ( Ptr )&WriteData;
masterTransaction.rxBuf = ( Ptr )&DummyByte;

GPIO_write(CC2640R2_LAUNCHXL_GPIO_SPI_CS, 0);
transferOK = SPI_transfer( masterSpi, &masterTransaction );
while(false == bSpiComplete);
bSpiComplete = false;
GPIO_write(CC2640R2_LAUNCHXL_GPIO_SPI_CS, 1);
*pbuf = DummyByte[1];
if( !transferOK )
{
System_printf("Unsuccessful master SPI transfer\n");
}

}

2. i cannot able to read UID/not getting any interrupts if i comment "System_printf" statements in the same spi code.

what might be the problem..

1.issue with System_printf statements -- will they take time of rtos task(blocking the task) to print it in console.

2.issue with tasks and mail boxes.

3.issue with spi.

  • Hello Vamsi,

    Unfortunately we don't have any RTOS experts on the team, so this is not a query we can support in detail.

    I would recommend reviewing the TI-RTOS handling of this TI Design to see how the NFC communication was dealt with: www.ti.com/.../TIDM-TM4C129XNFC

    My recollection is that you need to block during all NFC tasks, but that example will be your best reference point as it successfully implements NFC with the TRF7970A with TI-RTOS.