Hi Gusy,
I wanna add the FlexCan to the S32 project of the Dual motor control Demo board,but there are some question in the progress,
Now,i describe the process of adding the FlexCan module:
1#,I built two files named FlexCan.h and FlexCan.c
FlexCan.c:
*******************************************************************************
*
* This file includes initial setting function of MPC5643L FlexCan peripheral module.
*
******************************************************************************/
#include "MPC5643L_qs.h"
#include "flexCan.h"
/******************************************************************************
* FlexCan functions
*****************************************************************************/
volatile FLEXCAN_tag *pFlexCan_0;
volatile FLEXCAN_tag *pFlexCan_1;
FlexCan.h:
*******************************************************************************
*
* This file includes initial setting and MACRO definitions of MPC5643L FlexCan
* peripheral module.
*
******************************************************************************/
#ifndef _FlexCan_H_
#define _FlexCan_H_
/******************************************************************************
* Global FlexCan variables definition
******************************************************************************/
// Pointer to FlexCan structure
extern volatile FLEXCAN_tag *pFlexCan_0;
extern volatile FLEXCAN_tag *pFlexCan_1;
/******************************************************************************
* FlexCan MACRO definitions
******************************************************************************/
/******************************************************************************
* FlexCan registers bit definition
******************************************************************************/
/******************************************************************************
* Exported functions
*******************************************************************************/
extern void Delay(void);
extern void InitFlexCAN_0(void);
extern void InitFlexCAN_1(void);
#endif /* _FlexCan_H_ */
2#,
add the header file to the MPC5643L_periph.h shown as below:
*******************************************************************************
*
* Detailed Description of the file.
*
******************************************************************************/
#include "siul.h"
#include "flexpwm.h"
#include "ctu.h"
#include "adc.h"
#include "eTimer.h"
#include "pit.h"
#include "dspi.h"
#include "flexCan.h"
3#,I built two files named MPC5643L_FlexCan_LLD.h and MPC5643L_FlexCan_LLD.c
MPC5643L_FlexCan_LLD.h:
*******************************************************************************
*
* This file includes initial setting and MACRO definitions of MPC5643L FlexCan
* peripheral module.
*
******************************************************************************/
#ifndef _MPC5643L_FlexCan_LLD_H_
#define _MPC5643L_FlexCan_LLD_H_
#ifdef __cplusplus
extern "C" {
#endif
#define FlexCan0_BASE 0xFFFC0000
#define FlexCan1_BASE 0xFFEC4000
/*******************************/
#ifdef __cplusplus
}
#endif
#endif /* _MPC5643L_FlexCan_LLD_H_ */
MPC5643L_FlexCan_LLD.c:
*******************************************************************************
*
* This file includes initial setting functions of MPC5643L FlexCan module.
*
******************************************************************************/
#include "MPC5643L_qs.h"
#include "MPC5643L_FlexCan_LLD.h"
/******************************************************************************
* FlexCan functions
*****************************************************************************/
4#,add the header file the MPC5643L_FlexCan_LLD.h to MPC5643L_LLD.h shown as below:
*******************************************************************************
*
* Detailed Description of the file.
*
******************************************************************************/
#include "MPC5643L_ADC_LLD.h"
#include "MPC5643L_CTU_LLD.h"
#include "MPC5643L_DSPI_LLD.h"
#include "MPC5643L_ETIMER_LLD.h"
#include "MPC5643L_FlexPWM_LLD.h"
#include "MPC5643L_PIT_LLD.h"
#include "MPC5643L_SIUL_LLD.h"
#include <MPC5643L_FlexCan_LLD.h>
But there are some error popup,shown as below:
The tip seems said that undefined the initFlexCan_0,but i clearly define the function in the flexCan.h and flexCan.c
I don't konw how to deal with it,The attachment is the S32 project.
Original Attachment has been moved to: Test_2.zip
Solved! Go to Solution.
Hi edenli,
I managed to reproduce your issue and fix it - but i have no explanation for this behavior (you might need to ask the guys from S32DS Community)
So, how to fix it:
#1: Change the FlexCAN.C into FlexCAN.c (looks like the *.C is associated with C++ source files)
#2: delete the Debug folder and use Clean Project command to remove any other intermediate files
#3: Build the project and it should work fine now that all the source file are with "*.c" extension
Hope this resolve your issue.
Best regards,
Daniel
Hi edenli
It seems like your function definitions are not included by the main.c
As far as i can see the FlexCan.h is not included by any of the other headers used in main.c
If i include it from main.c it seems to work.
Hope this helps!
Daniel
Hi Daniel,
the header file FlexCan.h is included in the file MPC5643L_qs.h
and then
next:
So the flexCan.h include in the main.c
but still has the error:
How to deal with it,Daniel?
Hi edenli,
I managed to reproduce your issue and fix it - but i have no explanation for this behavior (you might need to ask the guys from S32DS Community)
So, how to fix it:
#1: Change the FlexCAN.C into FlexCAN.c (looks like the *.C is associated with C++ source files)
#2: delete the Debug folder and use Clean Project command to remove any other intermediate files
#3: Build the project and it should work fine now that all the source file are with "*.c" extension
Hope this resolve your issue.
Best regards,
Daniel
Hi Daniel,
Thank you for your reply!
Next,The question about the S32 ,i will realse to theS32DS Community,Now i solve the question
Best Regards!
Eden Li
Hi edenli,
Glad to find you fix it.
In general - such questions are better to be addressed on the community responsible for that particular tool since they know better all the options. Nevertheless, we are trying to help with suggestion all of our members.
Best regards,
Daniel