@@ -32,34 +32,34 @@ RGB LED.
3232
3333HARDWARE
3434The demo runs on the OSP32 board; connect the OUT to the IN (loop back).
35- Furthermore, connect a (eg 10k) potmeter over GND and VDD (eg from J3C)
36- and connect the sliding contact of the potmeter to pin S2_B1. This
37- requires removing a jumper. See photo connections.jpg in the directory
38- for this sketch. Also make sure the correct MUX input is selected, see
39- #define of TARGET_DRV .
35+ Furthermore, connect a (e.g. 10k) potentiometer over GND and VDD
36+ (e.g. from J3C) and connect the sliding contact of the potentiometer to
37+ pin S2_B1. This requires removing a jumper. See photo connections.jpg in
38+ the directory for this sketch.
39+ Also make sure the correct MUX input is selected, see #define TARGET_ADCCHN .
4040In Arduino select board "ESP32S3 Dev Module".
4141
4242 +-------------------------+
4343 | OPS32 |
4444 USB | OUT o----+
45- ----o CMD SAID IN | | loopback cable
45+ ----o CMD SAIDIN | | loopback cable
4646 | [] IN o----+
47- | [+-] [] [] [] |
47+ | [+-] O O O |
4848 +--++-------------+-------+
49- || |S2_B1
50- || \|/
51- |+----- ############--+
52- | potmeter |
53- +--------------------+
49+ || |S2_B1
50+ || \|/
51+ |+----# ############--+
52+ | potentiometer |
53+ +--------------------+
5454
5555BEHAVIOR
56- When the potmeter is turned, the left RGB of SAID IN changes from red to blue.
57- The Serial shows the measured (raw ADC and the) voltage.
56+ When the potentiometer is turned, the left RGB of SAID IN changes from red
57+ to blue. The Serial shows the measured (raw ADC and the) voltage.
5858Please note the following
5959- The ADC (0..1023) has a voltage range of about 3.5V. As a result only 2/3
60- of the potmeter range (assuming 0..5V) the values will change.
60+ of the potentiometer range (assuming 0..5V) the values will change.
6161- The ADC measures with respect to VDD (not GND!), therefore the measurement
62- range is rougly 1.5..5.0.
62+ range is roughly 1.5..5.0.
6363- When this demo is run from USB CMD, there is a voltage drop caused by
6464 the protection diode on the ESP32 board. This results in a VDD that is
6565 below 5V (assuming an accurate USB power supply). This is "calibrated"
@@ -70,7 +70,7 @@ Welcome to aoosp_adcpot.ino
7070version: result 0.4.5 spi 0.5.8 osp 0.7.0
7171spi: init
7272osp: init
73- TARGET_DRV =6 (see #define to check if it matches your HW)
73+ TARGET_ADCCHN =6 (see #define to check if it matches your HW)
7474ADC:430 mV:3265
7575ADC:429 mV:3268
7676ADC:429 mV:3268
@@ -80,16 +80,17 @@ ADC:429 mV:3268
8080*/
8181
8282
83- // Address of the SAID and its ADC channel with the potmeter
83+ // Address of the SAID and its ADC channel with the potentiometer
8484#define TARGET_ADDR 0x002 // SAID IN on OSP32
85- #define TARGET_FBCHN 2 // Feedback channel of that SAID (left-most RGB of SAID IN)
86- #define TARGET_DRV 6 // SAID version v1.1: 1=R0 2=R1 3=R2 4=B0 5= B1 6=B2 7=G0 8=G1 9=G2
85+ #define TARGET_FBCHN 2 // LED feedback channel of that SAID (left-most RGB of SAID IN)
86+ #define TARGET_ADCCHN 6 // The ADC channel the potentiometer is connected to - for SAID V1.0, B1 is on channel 6, for SAID V1.1 on channel 5.
8787// On the OSP32 board, pin B1 of SAID IN is available via a jumper.
88- // That pin is used for the ADC, so we need to set the ADC MUX for that pin.
88+ // We connect the potentiometer to that pin, so the ADC MUX must activate that channel.
89+ // The mapping from ADC channel to driver is as follows:
90+ // SAID version V1.1: 1=R0 2=R1 3=R2 4=B0 5=B1 6=B2 7=G0 8=G1 9=G2
8991// Some EVKs have older SAIDs (v1.0) for footprint "SAID IN".
90- // Those older versions differ differ in ADC MUX numbering.
91- // In SAID version V1.0, B1 is connected to MUX 6.
92- // In SAID version V1.1, B1 is connected to MUX 5.
92+ // Those older versions differ in ADC MUX numbering.
93+ // SAID version V1.0: 1=R0 2=G0 3=B0 4=R1 5=G1 6=B1 7=R2 8=G2 9=B2
9394// See https://github.com/ams-OSRAM/OSP_aotop/tree/main/extras/manuals/saidversions
9495
9596
@@ -104,18 +105,18 @@ void setup() {
104105
105106 aospi_init ();
106107 aoosp_init ();
107- Serial.printf (" TARGET_DRV =%d (see #define to check if it matches your HW)\n " ,TARGET_DRV );
108+ Serial.printf (" TARGET_ADCCHN =%d (see #define to check if it matches your HW)\n " ,TARGET_ADCCHN );
108109
109110 // Bring up chain
110111 aoresult_t result;
111- result= aoosp_exec_resetinit (); CHECKRESULT (" aoosp_exec_resetinit " );
112+ result= aoosp_exec_resetinit (); CHECKRESULT (" resetinit " );
112113 if ( aoosp_exec_resetinit_last ()!=2 ) { Serial.printf (" ERROR: demo is written for OSP32 with loop back cable\n " ); return ; }
113114 result= aoosp_send_clrerror (0x000 ); CHECKRESULT (" clrerror" );
114115 result= aoosp_send_goactive (0x000 ); CHECKRESULT (" goactive" );
115116
116- // Measurements _not_ synchronized with PWM (because external pot); ADC mapped to TARGET_DRV .
117+ // Measurements _not_ synchronized with PWM (because external pot); ADC mapped to TARGET_ADCCHN .
117118 // See documentation of `aoosp_send_setadc()` for details on the ADC behavior.
118- result= aoosp_send_setadc (TARGET_ADDR, AOOSP_ADC_FLAGS_SYNC_DIS+TARGET_DRV ); CHECKRESULT (" setadc" );
119+ result= aoosp_send_setadc (TARGET_ADDR, AOOSP_ADC_FLAGS_SYNC_DIS+TARGET_ADCCHN ); CHECKRESULT (" setadc" );
119120 // ADC measurement takes 730us, wait that before first readadcdat.
120121 delay (1 );
121122}
0 commit comments