Debugger terminates session in middle of initialization

cancel
Showing results for 
Search instead for 
Did you mean: 

Debugger terminates session in middle of initialization

Jump to solution
286 Views
juansalvo94
Contributor I

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?

0 Kudos
1 Solution
128 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

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 .

pastedImage_2.png

Please change another gpio that haven't used, for example , you can test the LDEs :

pastedImage_3.png

Hope it helps


Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
6 Replies
128 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Juan Diego Scarini ,

Have you enable the PORTA clock ?

pastedImage_1.png

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!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
128 Views
juansalvo94
Contributor I

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)

PE_SIM.PNG

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

 

0 Kudos
128 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

HI Juan,

You can send attached your project througth Actions -> Edit ...,

or you can create a case to NXP support as I told you .

pastedImage_1.png

BR

Alice

0 Kudos
128 Views
juansalvo94
Contributor I

Hi Alice, I send you the project!

Thank you!

0 Kudos
129 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

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 .

pastedImage_2.png

Please change another gpio that haven't used, for example , you can test the LDEs :

pastedImage_3.png

Hope it helps


Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
128 Views
juansalvo94
Contributor I

Thank you!
I've used this image as a guide for connection: 

Resultado de imagen para FRDM-KL05Z

But, nevermind, i've marked that pin as SWD in my printed copy, thanks again!

Juan

0 Kudos