FlexCAN How can I get data frame signal on loop-back mode

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

FlexCAN How can I get data frame signal on loop-back mode

ソリューションへジャンプ
1,891件の閲覧回数
buccno
Contributor III

Hi all,

I am using an eval board with an S32k116 processor. I wrote a simple code about the FlexCAN-BUS protocol, I could see in the IDE that the data I sent was successfully transmitted. But I'm having trouble with the signal,

1st one; How can I see the data frame signal using a logic analyzer? (I connected the logic analyzer to the CAN TX pin, but it was constantly showing high when I read the reference manual, it said it would always show high or low.)

RMS32K1xx CAN TX: This pin is the transmit pin to the CAN bus transceiver. The dominant state is represented by logic level 0. The recessive state is represented by logic level 1.


2nd one; When I put the transmit and receive function I wrote into an infinite loop (I verified that it works by turning on the LED and in the expression section). When I connected the oscilloscope probes to the CAN HIGH and CAN LOW outputs, I could not get a proper signal. What would be the reason? I used to send and receive functions in blocking mode.)

 

タグ(4)
0 件の賞賛
返信
1 解決策
1,780件の閲覧回数
buccno
Contributor III

Hey Petr, I was wrong to set my CAN transceiver wake-up pins. My problem was solved—no such things as masking. Thanks for all your reply.

元の投稿で解決策を見る

0 件の賞賛
返信
10 返答(返信)
1,863件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

in loopback mode you will see nothing on CAN pins. Change configuration for normal mode, also modify bit timing, probably 83kbps is not desired one.

PetrS_0-1670326792822.png

Also board have to be powered with external 12V so SBC's transceiver is active. Then you should see transmitted message on CAN pins.

BR, Petr

1,855件の閲覧回数
buccno
Contributor III

Thanks a lot for your answer.


My current problem is; I enter timeout in receive or transmit functions in normal mode.

When I call the Confix RX function and call the receive function, I enter the timeout. When I use normal receive instead of blocking, I do not enter timeout. I am sending data from an external source. (Same ID with receive func)

Should I call another function?

0 件の賞賛
返信
1,846件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you can simply use nonblocking function with testing transfer status

ret = FLEXCAN_DRV_Receive(INST_FLEXCAN_CONFIG_1, RX_MAILBOX, &received_data);

while(FLEXCAN_DRV_GetTransferStatus(INST_FLEXCAN_CONFIG_1, RX_MAILBOX) != STATUS_SUCCESS) {;}

It will wait on while loop until message is received.

BR, Petr

0 件の賞賛
返信
1,841件の閲覧回数
buccno
Contributor III

Is this look good?


#define MSG_ID_1 (0x02)

#define MB_RX_0 (1U)

uint32_t CAN_config(const uint8_t mb_id, const uint32_t msg_id)
{
flexcan_data_info_t dataInfo =
{
.data_length = 8U,
.msg_id_type = FLEXCAN_MSG_ID_STD,
.enable_brs = false,
.fd_enable = false,
.fd_padding = 0U
};

status_t ret = FLEXCAN_DRV_ConfigRxMb(INST_FLEXCAN_CONFIG_1, mb_id, &dataInfo, msg_id);

return (ret == STATUS_SUCCESS);
}


uint32_t CAN_receive_data(const uint8_t mb_id)
{
flexcan_msgbuff_t rcv_data = {0};

/*rcv_data.cs = 0;
rcv_data.data =*/

//FLEXCAN_DRV_SetRxMaskType(INST_FLEXCAN_CONFIG_1, type_mask);

status_t ret = FLEXCAN_DRV_Receive(INST_FLEXCAN_CONFIG_1, mb_id, &rcv_data); //BLOCKING

while(FLEXCAN_DRV_GetTransferStatus(INST_FLEXCAN_CONFIG_1, mb_id) != STATUS_SUCCESS) {;}

return (ret == STATUS_SUCCESS);
}

タグ(4)
0 件の賞賛
返信
1,839件の閲覧回数
buccno
Contributor III

buccno_0-1670418153439.png

I can send data in the CAN analysis program, I think the trace part confirms this. But there is no success from GetTransferStatus in S32DS.

0 件の賞賛
返信
1,828件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

be sure your RX MB is configured to receive the ID you sent from CAN tool.
Or clear mask register to receive all IDs, for test.

BR, Petr

0 件の賞賛
返信
1,816件の閲覧回数
buccno
Contributor III

Sorry, I know, I ask a lot of questions but how can I clear register all ID's? IDK. My peripheral window is empty. I cannot check. 

0 件の賞賛
返信
1,810件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport
0 件の賞賛
返信
1,781件の閲覧回数
buccno
Contributor III

Hey Petr, I was wrong to set my CAN transceiver wake-up pins. My problem was solved—no such things as masking. Thanks for all your reply.

0 件の賞賛
返信
1,869件の閲覧回数
buccno
Contributor III

my test code, here

0 件の賞賛
返信