Problem when I try to receive a message through CAN

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

Problem when I try to receive a message through CAN

3,937 Views
JonAnder_Amante
Contributor II

Hi,

I have a problem when I try to receive a message through CAN. I want to check if I receive a data in S32 Design Studio, so I send the functions that I have used (The clock of CAN is 24 MHz and It is correct). I have different problems.

1. When I try to receive the messages, the dates are 0. 

2. I don´t know if I want to implement 0x because the dates I want to send are in the PCAN-View (In hexadecimal the dates are 11 22 34 44 (I only want to check if the first date is 11)

JonAnder_Amante_2-1716367937129.png

In the next pictures you can see the functions that I have used.

JonAnder_Amante_0-1716367802719.pngJonAnder_Amante_1-1716367833311.png

In summary, the target of this program is the implementation of bootloader. The problem is that I want to check if the jump to the application is made depending on a CAN message is received. (The application is a program which send and receive different dates).

In the main I have these functions and structures:

JonAnder_Amante_3-1716368394761.pngJonAnder_Amante_4-1716368422835.png

I have tried instead of "g_RXCANMsg" instead of implement "rxData" but I havce problem because the program said that the variable "g_RXCANMsg" doesn´t definied, so Could you tell me the steps to implement this varibale?

Thank you for all,

 

 

0 Kudos
Reply
10 Replies

3,916 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

hard to suggest from given code snippets. 
If you see issues with project building, you need to find root cause yourself.
1) When you call Flexcan_Ip_Receive with pointing to "g_RXCANMsg", then after successful reception you will get callback function and "g_RXCANMsg" contains message content you sent from PCAN tool.
2) In PCAN tool you put hex values, so in your code, so first byte is 0x11, then you should test for 0x11, not 0x17 you have

BR, Petr

 

0 Kudos
Reply

3,896 Views
JonAnder_Amante
Contributor II

Hi,

Thank you for your information but I have different questions. I want to use the variable "g_RXCANMsg" and the definition of this variable is on the "main.c" and I want to use this variable in the file "boot_Cfg.c". I think that the structure "FlexCAN_Ip_MsgBuffType" is important but i don´t know what commands I have to implement in the file "Boot_Cfg.c" to use this varibale in the file "boot_Cfg.c". I send you different picture to understand the problem because I can´t compile the project because of this problem.

I hope your answer as soon as possible.

Thank you

 

JonAnder_Amante_0-1716534439755.pngJonAnder_Amante_1-1716534472084.png

JonAnder_Amante_2-1716534522204.png 

JonAnder_Amante_3-1716534571590.png

 

 

0 Kudos
Reply

3,894 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

try to use extern FlexCAN_Ip_MsgBuffType g_RXCANMsg; in your c file.

BR, Petr

0 Kudos
Reply

3,888 Views
JonAnder_Amante
Contributor II

Hi,

I have tried your idea and I have an error. The error said that there are multiple definition of g_RXCANMsg and I don´t know how I can solve the problem. Could you tell me the steps to solve it?

Thank you for all,

JonAnder_Amante_0-1716551153353.png

 

 

0 Kudos
Reply

3,883 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

I do not see you have extern keyword used.

BR, Petr

0 Kudos
Reply

3,811 Views
JonAnder_Amante
Contributor II

Hi,

I don´t understand you when you tell me that I have to use  a extern keyword. Could you tell me steps to implement this? I undestood that I have to add the command "FlexCAN_Ip_MsgBuffType g_RXCANMsg;" but I haven´t achieved nothing. 

Thank you for all,

0 Kudos
Reply

3,807 Views
PetrS
NXP TechSupport
NXP TechSupport
0 Kudos
Reply

3,776 Views
JonAnder_Amante
Contributor II

Hi,

I keep having problems. The target is that bootloader achieves to do "Request Backdoor", in the project I have implemented it with a button but I want to receive a message and then jump to the application. I want to use a variable called "g_RXCANMsg" which is in the "main.c" and I want to use in the file "Boot_Cfg.c". Could you send the command that I have to implement and where I have to use the command? I have read the link that I send me but I haven´t achieved any solution.

Thank you for all,

JonAnder_Amante_0-1716880831950.png

 

0 Kudos
Reply

3,724 Views
JonAnder_Amante
Contributor II

Hi,

I have achieved implement the variables with "extern" but I don´t achieve to receive any value through CAN. Could you tell me the command that I have to use, I think that I have to use the command "Receive"

 

Thank you

0 Kudos
Reply

3,661 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you should have MB prepared for reception using ConfigRxMb function then start receving by Receive function.

BR, Petr

0 Kudos
Reply