Skip to content

Commit e2c1407

Browse files
author
Maarten Pennings
committed
0.9.0
- Improved documentation for `aoosp_adcled.ino`, `aoosp_adcpot.ino`, `aoosp_cluster.ino`, `aoosp_sync.ino`, and `aoosp_otp.ino`. - `aoosp_exec_otpdump()` now dumps fields in table format (when passing `AOOSP_OTPDUMP_CUSTOMER_FIELDS`); old format retained via `AOOSP_OTPDUMP_CUSTOMER_FIELDSLIST`; updated examples and doc. - `aoosp_exec_otpdump()` now includes the EVK fields (at address 0x1F). - Added `aoosp_exec_skipchns_get()` and `aoosp_exec_skipchns_set()`. - Added example `aoosp_i2c12.ino` (12 bits I2C). - Added support for 12 bit I2C: `aoosp_send_i2cread12()`, `aoosp_send_i2cwrite12()`, and macros `aoosp_exec_i2cread12()`, `aoosp_exec_i2cwrite12()`. - Improved comments in `aoosp_send.cpp/h`. - Added link to examples.
1 parent 7fbaf41 commit e2c1407

File tree

21 files changed

+876
-210
lines changed

21 files changed

+876
-210
lines changed

examples/aoosp_adcled/aoosp_adcled.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@ Measured (10x) at 24mA and 100% PWM
6262

6363

6464
// Address of the SAID whose Vf we measure
65-
#define TARGET_ADDR 0x001 // SAID OUT on OSP32 (ALERT: make sure to select a SAID version B, not A)
65+
#define TARGET_ADDR 0x001 // SAID OUT on OSP32 (ALERT: make sure to select a SAID version v1.1, not v1.0)
6666
#define COUNT 10 // Averaging ADC over COUNT samples
6767
#define PWM 0xFFFF // Highest PWM gives highest accuracy (for ADC measurement)
68+
// See https://github.com/ams-OSRAM/OSP_aotop/tree/main/extras/manuals/saidversions
6869

6970

7071
// Simple error handling

examples/aoosp_adcpot/aoosp_adcpot.ino

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -32,34 +32,34 @@ RGB LED.
3232
3333
HARDWARE
3434
The 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.
4040
In 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
5555
BEHAVIOR
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.
5858
Please 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
7070
version: result 0.4.5 spi 0.5.8 osp 0.7.0
7171
spi: init
7272
osp: 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)
7474
ADC:430 mV:3265
7575
ADC:429 mV:3268
7676
ADC: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
}

examples/aoosp_cluster/aoosp_cluster.ino

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// aoosp_cluster.ino - illustrates how to use driver cluster
22
/*****************************************************************************
3-
* Copyright 2024 by ams OSRAM AG *
3+
* Copyright 2024,2025 by ams OSRAM AG *
44
* All rights are reserved. *
55
* *
66
* IMPORTANT - PLEASE READ CAREFULLY BEFORE COPYING, INSTALLING OR USING *
@@ -310,19 +310,19 @@ void set_cluster(int newcluster) {
310310

311311
// Print old cluster configuration
312312
result= aoosp_send_readotp(ADDR, OTPADDR_CH_CLUSTERING, &val, 1); cluster = val >> 5;
313-
if( result!=aoresult_ok ) Serial.printf("aoosp_send_readotp %s\n", aoresult_to_str(result) );
313+
if( result!=aoresult_ok ) Serial.printf("readotp %s\n", aoresult_to_str(result) );
314314
Serial.printf("From OTP[%02X]=%02X: cluster=%d\n",OTPADDR_CH_CLUSTERING, val, cluster);
315315

316316
// Check test password
317317
if( aoosp_said_testpw_get()==AOOSP_SAID_TESTPW_UNKNOWN ) Serial.printf("ERROR: SAID test password not configured\n" );
318318

319319
// Write new cluster to OTP (mirror)
320320
result= aoosp_exec_setotp(ADDR, OTPADDR_CH_CLUSTERING, OTPMASK_CLUSTER(newcluster), OTPMASK_CH_CLUSTERING);
321-
if( result!=aoresult_ok ) Serial.printf("setpwmchn %s\n", aoresult_to_str(result) );
321+
if( result!=aoresult_ok ) Serial.printf("setotp %s\n", aoresult_to_str(result) );
322322

323323
// Print old cluster configuration
324324
result= aoosp_send_readotp(ADDR, OTPADDR_CH_CLUSTERING, &val, 1); cluster = val >> 5;
325-
if( result!=aoresult_ok ) Serial.printf("aoosp_send_readotp %s\n", aoresult_to_str(result) );
325+
if( result!=aoresult_ok ) Serial.printf("readotp %s\n", aoresult_to_str(result) );
326326
Serial.printf("To OTP[%02X]=%02X: cluster=%d\n",OTPADDR_CH_CLUSTERING, val, cluster);
327327
}
328328

@@ -331,13 +331,13 @@ void cluster_demo() {
331331
aoresult_t result;
332332
uint32_t id;
333333

334-
// Reset and initialize all nodes and
334+
// Reset and initialize all nodes
335335
result= aoosp_exec_resetinit();
336-
if( result!=aoresult_ok ) Serial.printf("setpwmchn %s\n", aoresult_to_str(result) );
336+
if( result!=aoresult_ok ) Serial.printf("resetinit %s\n", aoresult_to_str(result) );
337337

338338
// Check node ADDR is a SAID
339339
result= aoosp_send_identify(ADDR, &id);
340-
if( result!=aoresult_ok ) Serial.printf("setpwmchn %s\n", aoresult_to_str(result) );
340+
if( result!=aoresult_ok ) Serial.printf("identify %s\n", aoresult_to_str(result) );
341341
if( ! AOOSP_IDENTIFY_IS_SAID(id) ) Serial.printf("ERROR: targeting node %03X, but this is not a SAID\n", ADDR );
342342

343343
// Configure cluster
@@ -346,11 +346,11 @@ void cluster_demo() {
346346

347347
// Clear the error flags of all nodes; SAIDs have the V flag (over-voltage) after reset, preventing them from going active.
348348
result= aoosp_send_clrerror(0x000);
349-
if( result!=aoresult_ok ) Serial.printf("setpwmchn %s\n", aoresult_to_str(result) );
349+
if( result!=aoresult_ok ) Serial.printf("clrerror %s\n", aoresult_to_str(result) );
350350

351351
// Switch the state of all nodes to active (allowing to switch on LEDs).
352352
result= aoosp_send_goactive(0x000);
353-
if( result!=aoresult_ok ) Serial.printf("setpwmchn %s\n", aoresult_to_str(result) );
353+
if( result!=aoresult_ok ) Serial.printf("goactive %s\n", aoresult_to_str(result) );
354354

355355
// Run all 9 cases of switching one driver on
356356
Serial.printf("\n");

0 commit comments

Comments
 (0)