CAN TJA1145 SPI Interface

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

CAN TJA1145 SPI Interface

3,401 Views
vinicius_olivei
Contributor III

Hello,

In this project I need to interface CAN transceiver TJA1145.

I do have NXP basic drivers for this device, but I'm trying something simple with no success.

For example, when I read the register 0xFE ( Device ID - A byte reserved for identification code), I should get the response 0x74(TJA1145), but the response is always 0xFF. I have tried with 0xFD ( data shifted to read byte ) and with 0xFE with no lucky.

Can anyone help me?

Thanks for your support.

0 Kudos
3 Replies

2,219 Views
vinicius_olivei
Contributor III

Hi Wang,

I could read the data, using simple Arduino mega, BUT I had to invert MISO and MOSI....

#include <SPI.h>
// the setup function runs once when you press reset or power the board
int highbyte=0b11111101;
int lowbyte =0b00000000;
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(53, OUTPUT);
  digitalWrite(53, HIGH);
  Serial.begin(9600);
  SPI.begin();
  SPI.beginTransaction(SPISettings(100000, MSBFIRST, SPI_MODE1));
}
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  digitalWrite(53, LOW);
  int result_0 = SPI.transfer16(0xFD00);
  delayMicroseconds(7);
  SPI.endTransaction();
  digitalWrite(53, HIGH);
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(10);                  
  Serial.println(result_0, HEX);
}
and I get 0x74 as response.
But now I can´t get CAN to work properly.
Best.
Vinicius.
0 Kudos

2,219 Views
1971439734
Contributor II

Hi Vinicius! 

      My spi not work,same order, connection is ok. I don't  the reason.

Is that something wrong about the Frequence of the spi port?

0 Kudos

2,219 Views
空心木头_mm
Contributor I

hello:

      Have your problem been sovled, I have the same issue with you, would you share your answer with me?

Thanks for advance!

Best regards!

0 Kudos