LPCopen example project to ADC

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LPCopen example project to ADC

898 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ledi007 on Wed Feb 17 09:57:03 MST 2016
Hi guys,

i use the LPC824 Xpresso board and in the example project of LPCopen (AD Conversion from channel 0 to 11) is a part which allows to transfer the conversion results to the host PC.

How can i receive this data via HTerm?
Which connections (pins) must i use for TX and RX?


T[u]his is the code snippet:[/u]
if (rawSample & (ADC_DR_OVERRUN | ADC_SEQ_GDAT_DATAVALID))
{
DEBUGOUT("Chan: %d Val: %d\r\n", j, ADC_DR_RESULT(rawSample));
DEBUGOUT("Threshold range: 0x%x ", ADC_DR_THCMPRANGE(rawSample));
DEBUGOUT("Threshold cross: 0x%x\r\n", ADC_DR_THCMPCROSS(rawSample));
DEBUGOUT("Overrun: %s ", (rawSample & ADC_DR_OVERRUN) ? "true" : "false");
DEBUGOUT("Data Valid: %s\r\n\r\n", (rawSample & ADC_SEQ_GDAT_DATAVALID) ? "true" : "false");
}


标签 (1)
0 项奖励
回复
1 回复

622 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Wojtkingson on Thu Feb 18 02:52:28 MST 2016
Hi,

these pins are  P0.7 - TX and P0.18 - RX (according code) but there is maybe little problem, because in the comment is written:

/* Connect the U0_TXD_O and U0_RXD_I signals to port pins(P0.17, P0.18) */

So try connect on pin 7, 18 or 17, 18 and maybe there is problem with example because they disabled fixed functions pins, which are in comment, but then they used other pins to use for TX
Chip_SWM_DisableFixedPin(SWM_FIXED_ADC8);    // 0.18
Chip_SWM_DisableFixedPin(SWM_FIXED_ADC9);    // 0.17

You can find it in

adc.c - Board_init() -> DEBUGINIT() -> Board_Debug_Init() -> Board_UART_Init()

Chip_SWM_MovablePinAssign(SWM_U1_TXD_O, 7);
Chip_SWM_MovablePinAssign(SWM_U1_RXD_I, 18);


If there is sitll problem, try this

You have to change in Board_UART_Init()

} else if (DEBUG_UART == LPC_USART1) {
Chip_SWM_MovablePinAssign(SWM_U1_TXD_O, 7);
Chip_SWM_MovablePinAssign(SWM_U1_RXD_I, 18);

to
} else if (DEBUG_UART == LPC_USART1) {
Chip_SWM_MovablePinAssign(SWM_U1_TXD_O, 17);

and connect UART with 115 200 on pins 17 and 18 and GND

Edit:
I look, that you are trying to read all channels on ADC, but it could be problem, because ADC pins are used for debug uart

Chip_SWM_DisableFixedPin(SWM_FIXED_ADC8);    // 0.18
Chip_SWM_DisableFixedPin(SWM_FIXED_ADC9);    // 0.17
0 项奖励
回复