industrialNETworXnetx

d0mbr1

d0mbr1

| 26.02.2009 | 08:19 | 2 replies

CAN HAL send/receive [using CAN sample program]

Hello Everyone,

I would like to ask about CAN HAL sending and receiving of data.

Currently I'm using CAN HAL sample program from Hilscher.

I have used the sample program without any modification,
so the CAN baud rate of NETX would be 1Mbps.

I have connected the UART pins to the serial port and
the Tantino JTAG to my PC.

I have also used a CAN analyzer and connected it to the CAN port Channel 3.

My problem is that when I ran the program, and send data to CAN port Channel 3
using my CAN analyzer, the serial output is shown below:

port 00000003 stats:
ulTxErrCnt               : 00000000
ulRxErrCnt               : 00000088
ulTxFrameSucceed         : 00000000
ulTxErrorSummary         : 00000000
ulArbitrationLost        : 00000000
ulConDroppedDueFifoFull  : 00000000
ulRxFrameSucceed         : 00000000
ulRxErrorSummary         : 00009EE6
ulIndHiDroppedDueFifoFull: 00000000
ulIndLoDroppedDueFifoFull: 00000000
ulRxStdFramesFiltered    : 00000000
ulRxExtFramesFiltered    : 00000000
ulRxStdFramesPassed      : 00000000
ulRxExtFramesPassed      : 00000000
ulRxStdFramesHiDetected  : 00000000
ulRxExtFramesHiDetected  : 00000000
ulStatus                 : 00000006

Why does the sample program do not respond when CAN analyzer sends data?

Also when I try to send data using the following code: (every 2 seconds)

Can_SendFrame(CAN_CHANNEL_NUMBER, &tFrame, 1, 1, 0); /* low prio, unlimited retries, confirmed */

the sample code does not send data to the CAN bus and the serial output
shows as seen below:

port 00000003 stats:
ulTxErrCnt               : 000000C0
ulRxErrCnt               : 00000000
ulTxFrameSucceed         : 00000000
ulTxErrorSummary         : 00000008
ulArbitrationLost        : 00000000
ulConDroppedDueFifoFull  : 00000000
ulRxFrameSucceed         : 00000000
ulRxErrorSummary         : 00000000
ulIndHiDroppedDueFifoFull: 00000000
ulIndLoDroppedDueFifoFull: 00000000
ulRxStdFramesFiltered    : 00000000
ulRxExtFramesFiltered    : 00000000
ulRxStdFramesPassed      : 00000000
ulRxExtFramesPassed      : 00000000
ulRxStdFramesHiDetected  : 00000000
ulRxExtFramesHiDetected  : 00000000
ulStatus                 : 00000006

Why does might have caused the above scenario?

Thank you very much in advance.

Regards,

M T

M T

Hilscher Gesellschaft für Systemautomation mbH

| 26.02.2009 | 14:27

d0mbr1 wrote:

port 00000003 stats:
ulTxErrCnt               : 00000000
ulRxErrCnt               : 00000088
ulTxFrameSucceed         : 00000000
ulTxErrorSummary         : 00000000
ulArbitrationLost        : 00000000
ulConDroppedDueFifoFull  : 00000000
ulRxFrameSucceed         : 00000000
ulRxErrorSummary         : 00009EE6

Why does the sample program do not respond when CAN analyzer sends data?

As you can see the XPEC indicates reception errors (RxErrCnt, also called REC). There seems to be something wrong with your CAN bus. Probably wrong hardware settings etc.

d0mbr1 wrote:

Also when I try to send data using the following code: (every 2 seconds)
Can_SendFrame(CAN_CHANNEL_NUMBER, &tFrame, 1, 1, 0); /* low prio, unlimited retries, confirmed */

the sample code does not send data to the CAN bus and the serial output
shows as seen below:

port 00000003 stats:
ulTxErrCnt               : 000000C0
ulRxErrCnt               : 00000000
ulTxFrameSucceed         : 00000000
ulTxErrorSummary         : 00000008
ulArbitrationLost        : 00000000

Why does might have caused the above scenario?

Same here. The bus seems to be broken. As you can see TxErrCnt (TEC, transmit error counter) is incremented. First of all check your cables, HW connection, etc.

Regards

MT

d0mbr1

d0mbr1

| 03.03.2009 | 01:02

Thanks MT. It was a hardware connection problem.

Login