Debug pin functions lost

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

Debug pin functions lost

1,769 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lucamini on Mon Oct 06 07:58:23 MST 2014
I'm searching for the issue in the subject.
I lost the debug usage when my LPC1517 executes this routine, but I'm unable to find which is the problem because no one pins is the debug one (SWD interface):

The routine is:

void Board_analInputInit(void)
{
/* Setup ADC for 12-bit mode and normal power */
Chip_ADC_Init(LPC_ADC0, 0);

/* Setup for maximum ADC clock rate */
Chip_ADC_SetClockRate(LPC_ADC0, ADC_MAX_SAMPLE_RATE);

/* For ADC0, sequencer A will be used without threshold events.
It will be triggered manually by the sysTick interrupt and
only monitor the internal temperature sensor. */
Chip_ADC_SetupSequencer(LPC_ADC0, ADC_SEQA_IDX, ( ADC_SEQ_CTRL_CHANSEL(0) | ADC_SEQ_CTRL_CHANSEL(1) | ADC_SEQ_CTRL_CHANSEL(2) | ADC_SEQ_CTRL_CHANSEL(3) | ADC_SEQ_CTRL_CHANSEL(4) | ADC_SEQ_CTRL_CHANSEL(5) | ADC_SEQ_CTRL_CHANSEL(6) | ADC_SEQ_CTRL_CHANSEL(7) | ADC_SEQ_CTRL_CHANSEL(10) |
ADC_SEQ_CTRL_MODE_EOS));
/* Disables pullups/pulldowns and disable digital mode */
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 0, IOCON_FUNC1 | IOCON_MODE_INACT | IOCON_ADMODE_EN);
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 1, IOCON_FUNC1 | IOCON_MODE_INACT | IOCON_ADMODE_EN);
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 2, IOCON_FUNC1 | IOCON_MODE_INACT | IOCON_ADMODE_EN);
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 3, IOCON_FUNC1 | IOCON_MODE_INACT | IOCON_ADMODE_EN);
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 4, IOCON_FUNC1 | IOCON_MODE_INACT | IOCON_ADMODE_EN);
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 5, IOCON_FUNC1 | IOCON_MODE_INACT | IOCON_ADMODE_EN);
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 6, IOCON_FUNC1 | IOCON_MODE_INACT | IOCON_ADMODE_EN);
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 7, IOCON_FUNC1 | IOCON_MODE_INACT | IOCON_ADMODE_EN);
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 8, IOCON_FUNC1 | IOCON_MODE_INACT | IOCON_ADMODE_EN);  // power ctrl

/* Use higher voltage trim for both ADCs */
Chip_ADC_SetTrim(LPC_ADC0, ADC_TRIM_VRANGE_HIGHV);

Chip_SWM_EnableFixedPin(SWM_FIXED_ADC0_0);// pwr ctrl
Chip_SWM_EnableFixedPin(SWM_FIXED_ADC0_1);
Chip_SWM_EnableFixedPin(SWM_FIXED_ADC0_2);
Chip_SWM_EnableFixedPin(SWM_FIXED_ADC0_3);
Chip_SWM_EnableFixedPin(SWM_FIXED_ADC0_4);
Chip_SWM_EnableFixedPin(SWM_FIXED_ADC0_5);
Chip_SWM_EnableFixedPin(SWM_FIXED_ADC0_6);
Chip_SWM_EnableFixedPin(SWM_FIXED_ADC0_7);
Chip_SWM_EnableFixedPin(SWM_FIXED_ADC0_10);

/* Need to do a calibration after initialization and trim */
Chip_ADC_StartCalibration(LPC_ADC0);
while (!(Chip_ADC_IsCalibrationDone(LPC_ADC0)))
{
}

/* Clear all pending interrupts */
Chip_ADC_ClearFlags(LPC_ADC0, Chip_ADC_GetFlags(LPC_ADC0));

/* Enable sequence A completion interrupts for ADC0 */
Chip_ADC_EnableInt(LPC_ADC0, ADC_INTEN_SEQA_ENABLE);

/* Enable related ADC NVIC interrupts */
NVIC_EnableIRQ(ADC0_SEQA_IRQn);

/* Enable sequencers */
Chip_ADC_EnableSequencer(LPC_ADC0, ADC_SEQA_IDX);
}


Thanks,
Luca

0 Kudos
Reply
9 Replies

1,725 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Thu Oct 09 22:17:07 MST 2014

Quote: lucamini
At reset, the pin recover it's default status...



No, SWM is different   :O

UM10736:


Quote:
8.3 Basic configuration
...
[color=#f00]Remark: The switch matrix is only reset by a POR or BOD reset. A hardware reset via the
RESET pin or a watchdog timer reset do not reset the switch matrix.[/color] Therefore, peripheral
functions remain connected to pins through the hardware or watchdog reset and the pins
remain input or output as defined by the switch matrix and assume the default state as
defined by the peripheral connected to them.

0 Kudos
Reply

1,725 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Thu Oct 09 21:17:58 MST 2014
Hi lucamini,
Can you try after turning off power to the board?  Debugger should connect at each power on.
SWM retains its state and won't reset by just asserting reset to device.
0 Kudos
Reply

1,725 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lucamini on Thu Oct 09 08:38:18 MST 2014
Yes, but that don't explain why if I configure it as adc I lost the debug functionality. At reset, the pin recover it's default status and the debugger should reset the device at the beginning of the debug session(I have the reset pin connected to the lpclink2), so it is not so clear why it doesn't work but works if I force the level to gnd.
0 Kudos
Reply

1,725 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Wed Oct 08 09:38:51 MST 2014

Quote: lucamini
I found that the problem is the:

Chip_SWM_EnableFixedPin(SWM_FIXED_ADC0_4);

In the documentation nothing is told about this.



:quest:

UM10736:


Quote:
Table 90. ISP pin assignments

ISP pin   LQFP48
[color=#f00]ISP_0     PIO0_4[/color]

0 Kudos
Reply

1,725 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lucamini on Wed Oct 08 08:04:05 MST 2014
no, it is a lqfp48
0 Kudos
Reply

1,725 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Tue Oct 07 08:58:07 MST 2014

Quote: lucamini
It is the first thing I written in the first post : LPC1517



So it is a LQFP 70.7?
0 Kudos
Reply

1,725 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lucamini on Tue Oct 07 08:51:10 MST 2014
It is the first thing I written in the first post : LPC1517
0 Kudos
Reply

1,725 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Tue Oct 07 07:03:56 MST 2014
Could be useful if you describe which chip you are using...
0 Kudos
Reply

1,725 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lucamini on Tue Oct 07 06:10:50 MST 2014
I found that the problem is the:

Chip_SWM_EnableFixedPin(SWM_FIXED_ADC0_4);

with this function I'm not able to debug another time whitout a recovering procedure.
But to read the analog channel I need to setup this.
In the documentation nothing is told about this. How I can solve?

Thanks
Luca
0 Kudos
Reply