Hi, My name is Juan and I'm having trouble with KDS and Processor Expert, in particular component BitIO_LDD.
I'm using FRDM_KL05Z for one project, i need to read some GPIO Pins, so I've decided to use the component of PE mentioned above.
But, when I (or processor expert) initialize the component, it terminates automatically the debug session. I've debugged step by step and every time crashes in the middle of Init. Sometimes it even crash KDS IDE.
The function is: GPIO_DIR0_Init(DIR0);
And is defined:
LDD_TDeviceData* GPIO_DIR0_Init(LDD_TUserData *UserDataPtr)
{
/* Allocate device structure */
GPIO_DIR0_TDeviceDataPtr DeviceDataPrv;/* {Default RTOS Adapter} Driver memory allocation: Dynamic allocation is simulated by a pointer to the static object */
DeviceDataPrv = &DeviceDataPrv__DEFAULT_RTOS_ALLOC;
DeviceDataPrv->UserDataPtr = UserDataPtr; /* Store the RTOS device structure */
/* Configure pin as input */
/* GPIOA_PDDR: PDD&=~1 */
GPIOA_PDDR &= (uint32_t)~(uint32_t)(GPIO_PDDR_PDD(0x01));
/* Initialization of Port Control register */
/* PORTA_PCR0: ISF=0,MUX=1 */// Terminates debug session when running next line
PORTA_PCR0 = (uint32_t)((PORTA_PCR0 & (uint32_t)~(uint32_t)(
PORT_PCR_ISF_MASK |
PORT_PCR_MUX(0x06)
)) | (uint32_t)(
PORT_PCR_MUX(0x01)
));
/* Registration of the device structure */
PE_LDD_RegisterDeviceStructure(PE_LDD_COMPONENT_GPIO_DIR0_ID,DeviceDataPrv);
return ((LDD_TDeviceData *)DeviceDataPrv);
}
Anyone have an idea on what can I do?
已解决! 转到解答。
Hello Juan,
I have checked your code. Please have a look at the SCH for FRDM-KL05 board,
the PTA0 connect to SWD_CLK pin , it also means, we used it when debugging .
Please change another gpio that haven't used, for example , you can test the LDEs :
Hope it helps
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello Juan Diego Scarini ,
Have you enable the PORTA clock ?
And why you use the initialize funciont GPIO_DIR0_Init() , not the Bit1_Init() when
you use the component of BitIO_LDD .
If still can't work , please send your whole project to me, I will help you check it on my side .
Hope it helps
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Alice! Thank you for your answer.
Looking at what you said, i've checked PE Processor Component, SIM Module.
There I found that there was no clock gating on PORTA and PORTB (Ports that I use)
So I've enabled the Clock Gating Control and when I enable it, the PORTA and PORTB options enable automatically.
Well, I've deceided to run the code in debugging mode, but when it comes to the initialization part, It freezes! The fail is in the exact same point.
The SIM_SCGC5 has the correct value 0x780, but it still freezes on the same part:
PORTA_PCR0 = (uint32_t)((PORTA_PCR0 & (uint32_t)~(uint32_t)(PORT_PCR_ISF_MASK |PORT_PCR_MUX(0x06))) | (uint32_t)(PORT_PCR_MUX(0x01)));
And i've got no ideas on what to do...
Thank you
Juan
Hello Juan,
I have checked your code. Please have a look at the SCH for FRDM-KL05 board,
the PTA0 connect to SWD_CLK pin , it also means, we used it when debugging .
Please change another gpio that haven't used, for example , you can test the LDEs :
Hope it helps
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------