LPCopen periph_adc example

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

LPCopen periph_adc example

500 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by xjx on Sun Nov 15 10:43:39 MST 2015
Hello,

I am trying to run the periph_adc example on LPCxpresso 1760 stick.

I compiled and run it with redlib semihost. I also have the uart connected to the PC with an RS232 interface.

One running the example, it writes some message to the console. However, I was expecting to see the ADC values somewhere in the console or in the COM terminal at the PC.

"

Hello NXP Semiconductors

ADC DEMO

Sample rate : 200kHz

Press 'c' to continue or 'x' to quit

Press 'o' or 'p' to set Sample rate

Press 'b' to ENABLE or DISABLE Burst Mode
"

when I press the keys nothing happens. Question: what is the example supposed to do?

thank you
Labels (1)
0 Kudos
4 Replies

428 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by xjx on Sun Nov 15 13:50:09 MST 2015
THe UART and Terminal in PC  are correctly working. I made the following checks:

1) with everything connected, the LPCxpresso echoes back the characters sent from PC->LPCxpresso. This is shown in Terminal at PC

2) when stick power is disconnected, the LPCxpresso does not echo back characters anymore

3) when serial cable is disconnected from LPCxpresso, no characters are echoed back to the terminal at PC.


It looks like the LPCxpresso is still running an old program, I do not why


May the following be happening? see last paragraph
Have a look at: http://docs.lpcware.com/lpcopen/v1.03/_l_p_c_o_p_e_n_17_x_x40_x_x__b_o_a_r_d__x_p_r_e_s_s_o_1769.htm...

Board recovery using the ISP pin
If the board's FLASH can no longer be programmed, the image in FLASH may be corrupt. To recover the board, the board must be reset with the ISP (P2.10) pin held low. To do this, attach a jumper between pin J6-51 (P2.10) and J6-1 (GND) and reset the board. On debuggers that reset the board prior to programming, the ISP pin should be held low until the programming cycle is started. Once started, it can be released.
If you have the LPCXpresso Base Board attached, you can press and hold SW3 on the base board on reset to reset with the ISP.


thanks in advance.
Julian
0 Kudos

428 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Sun Nov 15 12:45:36 MST 2015

Quote: xjx
However it does not appear in the COM console, ussing Putty or Hercules.



The your UART hardware or terminal setup is wrong...

UART2 is working here without problems:


Quote:
Hello NXP Semiconductors
ADC DEMO
Sample rate : 200kHz
Press 'c' to continue or 'x' to quit
Press 'o' or 'p' to set Sample rate
Press 'b' to ENABLE or DISABLE Burst Mode
c
Press number 1-3 to choose ADC running mode:
        1: Polling Mode
        2: Interrupt Mode
        3: DMA Mode
2
ADC value is : 0x02d8
ADC value is : 0x02d5
ADC value is : 0x02d2



0 Kudos

428 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by xjx on Sun Nov 15 12:15:27 MST 2015
Hello R2D2,

thank you but I do not understand your reply.

If I use the serial cable, is it ok to use the following config at board.h?
/** Define DEBUG_ENABLE to enable IO via the DEBUGSTR, DEBUGOUT, and
    DEBUGIN macros. If not defined, DEBUG* functions will be optimized
    out of the code at build time.
*/
#define DEBUG_ENABLE

/** Define DEBUG_SEMIHOSTING along with DEBUG_ENABLE to enable IO support
    via semihosting. You may need to use a C library that supports
    semihosting with this option.
*/
// #define DEBUG_SEMIHOSTING


The welcome message now dissapears in the console. However it does not appear in the COM console, ussing Putty or Hercules.

What I see in the Hercules console is the characters that I write being echoed back by the LPCxpresso. This behavior was OK when I tried the LPCOpen example "periph_uart_rb", but not now I guess.

thanks in advance
0 Kudos

428 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Sun Nov 15 11:38:17 MST 2015

Quote: xjx
I compiled and run it with redlib semihost. I also have the uart connected to the PC with an RS232 interface.

One running the example, it writes some message to the console. However, I was expecting to see the ADC values somewhere in the console or in the COM terminal at the PC.



Semihosting = Console IO :O

So use semihosting to get ADC values:


Quote:

Hello NXP Semiconductors

ADC DEMO

Sample rate : 200kHz

Press 'c' to continue or 'x' to quit

Press 'o' or 'p' to set Sample rate

Press 'b' to ENABLE or DISABLE Burst Mode

[color=#6c0]c[/color]


Press number 1-3 to choose ADC running mode:

1: Polling Mode

2: Interrupt Mode

3: DMA Mode

[color=#6c0]2[/color]

ADC value is : 0x0459

ADC value is : 0x030a




0 Kudos