hello
when i call the function byte MSCAN0_SendFrameExt(dword MessageID,byte FrameType,byte Length,const byte *Data),
it returns ERR_TXFULL,i check the register CANTFLG = 0x00,it means message duffer is full,so i don`t konw why buffers are all full?
i conncet a kvaser CAN data analysis as the other node,and this is my Processor Expert configuration
thanks.
Hi,
Now I have the only question. Is your CAN bus connected to another node. The CAN is not working when there is no acknowledge from other node.
Loop-back mode helps you to say the CAN peripheral is OK and something wrong is on the BUS or transceiver.
Best regards,
Ladislav
hi lama,
now i found the reason,i forgot enable CAN Physical Layer control register,that`s the reason why loop-back mode runs without any problem but can`t send data to bus.
thanks again :smileyhappy:
Hi,
there is nothing possible to say from your description. Is it immediate status at the beginning or it happens during Tx.
As a first approach for CAN debugging I use loop-back mode to be sure the CAN is correctly working at the MCU. Then I try to use it to communicate with other nodes. Sometimes I also use communication between two CANs at the same MCU without transceiver. (requires a few diodes and resistors) This approach then helps me to localize source of the issue easier.
So from the beginning.
1) Communication related: Have you read the error messages? Are you sure the last messages has been sent?
2) Setup related: What is the transceiver RxTx delay and line delay [us/m]?
I have attached an example code , uses 4MHz oscclk, CAN0 in loopback mode, data Tx/Rx are sent to SCI, 8bit, 9600bps.
Please , test only it is working to be sure the CAN peripheral is OK. (There are some dditional excel files as a part of the project attached, only as an example)
Best regards,
Ladislav
hi lama,
thank you for your example code,but my mcu is S12ZVC64,so there`s something wrong when i debug it.
when i call the function MSCAN0_SendFrameExt at first three times,err=0,mcu try to find a empty buffer to send message.until all buffers are full, function returns error ERR_TXFULL,so i think messages hasn`t been sent.
meanwhile,oscilloscope does not show any waveform from CAN_H or CAN_L
by the way,i tried loop mode,call the same function,in this way it returned OK,so does it mean CAN peripheral is OK?