I've been talking to UJA1169 chip on S32K144EVAL board via SPI and been able to R/W to a few registers.
I try to write to CAN control register (address 20h) the value 0x01 or 0x02 (CMC) to make CAN active
but when I read Transceiver status register (0x22) Bit 7(CTS) remains 0.
I'm pretty sure my SPI frames are sent and received correctly.
I was wondering the fact that I am not connected to any CAN bus may be the culprit here.
Could that be it?
Please ,I need some answers.
Probably you are still in default mode of this device, FNMC. In this mode you can access only a part of the device memory:
"In Forced Normal mode, only the Main status register, the Watchdog status register, the Identification register and registers stored in non-volatile memory can be read. The non-volatile memory area is fully accessible for writing as long as the UJA1169 is in the factory preset state (for details see Section 7.11)."
If you want to change this mode read this section from datasheet: Programming MTPNV cells or you can use the driver provided by the SDK which is included in S32DesignStudio.
Also, for some basic applications is not mandatory to configure the SBC because the CAN transceiver is enabled in active.
May be I did not clarify this in my original post however I was able to put the device in Normal mode, and when I read the mode it returns 3 and I can go back and forth between Normal mode and Standby mode. so in normal mode I can not configure the CAN active.
This is the issue.
Thanks for this details. In this case I suppose that the watchdog is triggered and non-volatile memory is erased. Can you check Reset pin?
By default watchdog is in timeout mode. If you want to disable it in Normal mode you should enable SDMS bit field and configure SBC in Autonomous mode.
The reset pin is not actually asserted .
A couple more thing that I forgot two mention:
I get out of the forced normal mode with Software development bit enable and with fnm bit disabled and set the mode to normal, As I mentioned previously there is no other CAN node and I am not transmitting anything, I try to set the Transceiver to CAN active and it fails to do so, and when I measure CAN HI CAN LO levels they both rea 2.5v .
I assumed if the SBC is offline they should at the ground level but I could be wrong.
Other possible issues are:
"The application can determine whether the CAN transceiver is ready to transmit/receive data (CAN supply above 90 % threshold) or is disabled by reading the CAN Transceiver Status (CTS) bit in the Transceiver Status Register (Table 16)."
Your board is powered from 12V power supply?
When this error occurs can you send date over CAN?
Can you try to connect our board to other bus and to test it again?
I ask this because CTS can be 0 if TXD dominant time-out occurs. (Chapter 7.9.1 from UJA1169 datasheet).
It took a bit long to get back to you as I was busy with the other modules ADC, I2C,......
I have connected my board to a CANALYZER with a G block . So when I use a virgin board where the SBC is in forced normal mode ,I have CAN communication but as soon as I set the SBC to normal mode ,I loose it. In my last post I wrote:
"when I read can status register at 0x22 (sending spi frame 0x4500) it returns (0x4540) meaning that CAN supply voltage is above %90 threshold and CAN trans is inactive."
I was wrong probably very sleepy when I wrote that . When I read CAN status register , it still returns 0X40 which means bit 6 of this register is set meaning "CAN partial networking error" .
At this point I'm really lost and I don't know what is going on.
My requirement is to run off of the normal mode and to be able to go to Standby mode.I can place the chip in those mode but when in Normal mode, I can't get the CAN active.
When you configure the SBC you should be sure that the wake-up configuration is right.
You can find more details about this set-up in 7.8 CAN partial networking (UJA1169 /F variants only) chapter.
Now, I remember that I faced a similar problem when I try to configure the SBC in sleep mode without configuring the wake-up sources. I think you enable the partial networking and because the configuration is not ok you can't use any CAN feature.
Also, you can use the drivers for SBC driver included in SDK. I think you can develop your project faster than writing directly the registers.
Thank you for your response.
My board is powered from 12v supply.
when I read can status register at 0x22 (sending spi frame 0x4500) it returns (0x4540) meaning that CAN supply voltage is above %90 threshold and CAN trans is inactive.
I will try to connect the board to a CAN BUS and test again as I AM NOT TRANSMITTING ANYTHING YET.
I will let you know, I suspect that your statement "CTS can be 0 if TXD dominant time-out occurs" may be the reason for this.