how can i use FlexCAN_s32k144 to transmit / receive data

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

how can i use FlexCAN_s32k144 to transmit / receive data

Jump to solution
1,685 Views
1450132053
Contributor II

Nowadays I tried to make a code associated with CAN.

I searched internet to find example code of  FlexCAN_s32k144 and didn't change anything to load in the board

I use CANTest to observe the data is nothing

 Baud rate 500k

Labels (1)
0 Kudos
1 Solution
1,509 Views
1450132053
Contributor II

Hi Petr,

Thank you anyway. I have solved the problem. The signal is  visible after the SBC is restored to the factory,Follow these steps to restore the on-board SBC to factory settings:
》S32K144EVB-Q100 power off ;

》pin RSTN from SBC is held LOW

》CANH(J13.1) is pulled up to VBAT(J11.2)
》CANL(J13.2) is pulled down to GND(J13.4)

》Power on the board with external supply 12V (J16)

, the program runs normally on the S32K144EVB Q100 development board.

Best regards,

chen

View solution in original post

0 Kudos
7 Replies
1,510 Views
1450132053
Contributor II

Hi Petr,

Thank you anyway. I have solved the problem. The signal is  visible after the SBC is restored to the factory,Follow these steps to restore the on-board SBC to factory settings:
》S32K144EVB-Q100 power off ;

》pin RSTN from SBC is held LOW

》CANH(J13.1) is pulled up to VBAT(J11.2)
》CANL(J13.2) is pulled down to GND(J13.4)

》Power on the board with external supply 12V (J16)

, the program runs normally on the S32K144EVB Q100 development board.

Best regards,

chen

0 Kudos
1,509 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you did not mentioned the board you have, assume you are using S32K144EVB

You can find several examples within S32 Design Studio.

BR, Petr

0 Kudos
1,509 Views
1450132053
Contributor II

hi petr,

   i am using S32k144evb-q100 to test CAN function ,

examples from SDK V3.0.0

Change as follows I have done to test transmit model:

int main(void) {

#ifdef PEX_RTOS_INIT    

PEX_RTOS_INIT();                

#endif  

  BoardInit();   

  GPIOInit();

   CAN_Init(&can_pal1_instance, &can_pal1_Config0);        

for(;;)     {      

while(CAN_GetTransferStatus(&can_pal1_instance, TX_MAILBOX) == STATUS_BUSY);      

 can_buff_config_t buffCfg =  {   

 .enableFD = true,   

 .enableBRS = true,   

 .fdPadding = 0U,   

 .idType = CAN_MSG_ID_STD,   

 .isRemote = false   };

  /* Configure TX buffer with index TX_MAILBOX*/  

 CAN_ConfigTxBuff(&can_pal1_instance, TX_MAILBOX, &buffCfg);

  /* Prepare message to be sent */   

can_message_t message = {    

.cs = 0U,  

  .id = TX_MSG_ID,   

 .data[0] = 0x32,  

  .length = 1U   };

  /* Send the information via CAN */  

 CAN_Send(&can_pal1_instance, TX_MAILBOX, &message);     }

 /*** Don't write any code pass this line, or it will be deleted during code generation. ***/   /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/

  #ifdef PEX_RTOS_START    

PEX_RTOS_START();                  /* Startup of the selected RTOS. Macro is defined by the RTOS component. */  

#endif   /*** End of RTOS startup code.  ***/  

/*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/  

for(;;) {    

if(exit_code != 0)

{      break;    }

  }  

return exit_code;

  /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/

 

when I finish this and load in the board,nothing I have receive in my PCAN,I use Oscilloscope test pins CAN _H and CAN_L, no signal displayed

Please tell me if you know what the problem is, thank you

0 Kudos
1,509 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

Do you have the EVB powered by external 12V voltage source? The SBC on the EVB requires external supply.

BR, Petr

0 Kudos
1,509 Views
1450132053
Contributor II

Hi Petr,

   yeah,I have used external 12V voltage source to supply power to EVB.

   today l test PTE4,PTE5 PIN if wrong,i Set them as ordinary IO ports,and used  Oscilloscope test PTE4,PT5 pins Input and output signals is ok,but when i use example project to observe PTE5 pin,i only see 5v Pin level,i didn't saw  Pin level have any change when i  set only send message mode.

0 Kudos
1,509 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

did you make it running meanwhile?

BR, Petr

0 Kudos
1,509 Views
1450132053
Contributor II

Hi Petr,

  Currently it does not work properly. In the past few days, I have tried to enable pte4 to a pull-up in demo can_pal_s32k144. When the USB power supply is separately connected, the PTE4 level is 5V. When sending data, I can see that pte4 has a waveform output, but After connecting an external power supply of 12V, the test pin Rx is at 0v level. After the data is sent, the pin has no level change. and I found that the  ptc12 and ptc13 were interrupted to be PTC13 and PTC14.

    i have no idea now,i am very thankful If you can give me a set of methods to test the CAN module (including sending module test and receiving module separate test)

Kind regards,

chen

0 Kudos