SPI problem example read ID from TJA1145

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

SPI problem example read ID from TJA1145

91 Views
Andreas85
Contributor I
When trying to read the ID via SPI, I receive the following responses. 0xFD74. From data sheet 0x74 is expected. 
 
Andreas85_0-1780388018820.png

 

But if I send the service 0xFD00  again, I get a different response from TJA1145. Why is that the case? The responses repeat cyclically which means BufferRx[4] would be 0xFD74.
 
Andreas85_1-1780388158647.png

 

Andreas85_2-1780388205712.png

 

I would like to set the transceiver to normal mode using 0x0207. However, here as well I receive different responses but not the response I expect.
 
Thanks for the support! 
0 Kudos
Reply
3 Replies

47 Views
ErikaC
NXP TechSupport
NXP TechSupport

Hello, The SPI interface operates in full‑duplex mode, meaning that data is transmitted and received simultaneously. However, the device does not return the result of the current command within the same SPI frame. Instead, the response corresponds to the previously received command.

So, could you please try 

Frame 1:
TX (MOSI): Read command → Address 0x7E with RO = 1
RX (MISO): Undefined or previous data

Frame 2:
TX (MOSI): Dummy data (e.g., 0x0000)
RX (MISO): Valid response → Device ID value (e.g., 0x74)

 

0 Kudos
Reply

43 Views
Andreas85
Contributor I

Thanks for the reply. 

If I send the message as recommended, I get the following answer:

Andreas85_0-1780425085548.png

 

It looks like the TJA1145 is responding with following register values  (16 Bit)and  reflecting SDI on SDO. I can also see if I sent Frame 1, pull SDI to low and start with reading register 0x7E, the response comes as expected.  

 

According to the datasheet, SDI can be left floating after the transfer. Does the slave need a low level to reset its internal state machine?

 

Thanks in advance! 

 

0 Kudos
Reply

6 Views
ErikaC
NXP TechSupport
NXP TechSupport

What is the external pull-up value connected to SDI?

Please see AH1903 Application Hints - High speed CAN transceiver for partial networking TJA1145A section 7.4.1 SDI pin input behavior that is under secure files!

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2374901%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ESPI%20problem%20example%20read%20ID%20from%20TJA1145%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2374901%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CDIV%3EWhen%20trying%20to%20read%20the%20ID%20via%20SPI%2C%20I%20receive%20the%20following%20responses.%200xFD74.%20From%20data%20sheet%200x74%20is%20expected.%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Andreas85_0-1780388018820.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Andreas85_0-1780388018820.png%22%20style%3D%22width%3A%20350px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F387519iD7C1136AF9AB3DB5%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Andreas85_0-1780388018820.png%22%20alt%3D%22Andreas85_0-1780388018820.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3C%2FDIV%3E%3CDIV%3EBut%20if%20I%20send%20the%20service%200xFD00%26nbsp%3B%20again%2C%20I%20get%20a%20different%20response%20from%20TJA1145.%20Why%20is%20that%20the%20case%3F%20The%20responses%20repeat%20cyclically%20which%20means%20BufferRx%5B4%5D%20would%20be%200xFD74.%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Andreas85_1-1780388158647.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Andreas85_1-1780388158647.png%22%20style%3D%22width%3A%20322px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F387521i971BEC8C6B74FFCE%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Andreas85_1-1780388158647.png%22%20alt%3D%22Andreas85_1-1780388158647.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Andreas85_2-1780388205712.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Andreas85_2-1780388205712.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F387522i736387D520561FEB%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Andreas85_2-1780388205712.png%22%20alt%3D%22Andreas85_2-1780388205712.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3CDIV%3EI%20would%20like%20to%20set%20the%20transceiver%20to%20normal%20mode%20using%200x0207.%20However%2C%20here%20as%20well%20I%20receive%20different%20responses%20but%20not%20the%20response%20I%20expect.%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3EThanks%20for%20the%20support!%26nbsp%3B%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2375211%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20SPI%20problem%20example%20read%20ID%20from%20TJA1145%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2375211%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThanks%20for%20the%20reply.%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20I%20send%20the%20message%20as%20recommended%2C%20I%20get%20the%20following%20answer%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Andreas85_0-1780425085548.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Andreas85_0-1780425085548.png%22%20style%3D%22width%3A%20340px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F387585i4A035811A9FE3935%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Andreas85_0-1780425085548.png%22%20alt%3D%22Andreas85_0-1780425085548.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EIt%20looks%20like%20the%20TJA1145%20is%20%3CSPAN%3Eresponding%20%3C%2FSPAN%3Ewith%20following%20register%20values%26nbsp%3B%20(16%20Bit)and%26nbsp%3B%20reflecting%20SDI%20on%20SDO.%20I%20can%20also%20see%20if%20I%20sent%20Frame%201%2C%20pull%20SDI%20to%20low%20and%20start%20with%20reading%20register%200x7E%2C%20the%20response%20comes%20as%20expected.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%3EAccording%20to%20the%20d%3C%2FSPAN%3Eatasheet%2C%26nbsp%3BS%3CSPAN%3EDI%20can%20be%20left%20floating%20after%20the%20transfer.%20Does%20the%20slave%20need%20a%20low%20level%20to%20reset%20its%20internal%20state%20machine%3F%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EThanks%20in%20advance!%26nbsp%3B%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2375175%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20SPI%20problem%20example%20read%20ID%20from%20TJA1145%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2375175%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%26nbsp%3BThe%20SPI%20interface%20operates%20in%20full%E2%80%91duplex%20mode%2C%20meaning%20that%20data%20is%20transmitted%20and%20received%20simultaneously.%20However%2C%20the%20device%20does%20not%20return%20the%20result%20of%20the%20current%20command%20within%20the%20same%20SPI%20frame.%20Instead%2C%20the%20response%20corresponds%20to%20the%20previously%20received%20command.%3C%2FP%3E%0A%3CP%3ESo%2C%20could%20you%20please%20try%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFrame%201%3A%3CBR%20%2F%3ETX%20(MOSI)%3A%20Read%20command%20%E2%86%92%20Address%200x7E%20with%20RO%20%3D%201%3CBR%20%2F%3ERX%20(MISO)%3A%20Undefined%20or%20previous%20data%3C%2FP%3E%0A%3CP%3EFrame%202%3A%3CBR%20%2F%3ETX%20(MOSI)%3A%20Dummy%20data%20(e.g.%2C%200x0000)%3CBR%20%2F%3ERX%20(MISO)%3A%20Valid%20response%20%E2%86%92%20Device%20ID%20value%20(e.g.%2C%200x74)%3C%2FP%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E