Skip to content

Commit f51e277

Browse files
0.4.2
- Fixed TID bug in `aoosp_con_seti2ccfg()`. - `aoosp_exec_i2cpower(addr)` now also checks if addr is a SAID. - Detailed addressing for `aoosp_send_xxx()` and removed old datasheet names. - Corrected documentation on <addr> in `aoosp_exec_xxx()` functions. - Added topology check to `aoosp-time.ino`. - Added explanation for SYNC via pin in `aoosp_sync.ino`. - Added remark on OTP password for `aoosp_otp.ino`. - I2C in `aoop_i2c.ino` description updated and device address changed to match OSP32. - Now also powering I2C bus in `aoosp_i2c.ino` for EEPROM. - Role of 'mult' in `aoosp_error.ino` explained. - Added BEHAVIOR section to explanation in examples.
1 parent cf1eda8 commit f51e277

File tree

15 files changed

+234
-108
lines changed

15 files changed

+234
-108
lines changed

examples/aoosp_crc/aoosp_crc.ino

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ The demo runs on the OSP32 board, no demo board needs to be attached.
3535
In Arduino select board "ESP32S3 Dev Module".
3636
Since this demo does not use any OSP related hardware, any ESP32[S3] will do.
3737
38+
BEHAVIOR
39+
Nothing to be seen, example only computes CRC.
40+
3841
OUTPUT
3942
Welcome to aoosp_crc.ino
4043
buf A0 07 CF 00 FF 08 88 00 11 08 88 00=94 ERROR

examples/aoosp_error/aoosp_error.ino

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,37 +40,44 @@ The demo runs on the OSP32 board. Have a cable from the OUT connector to
4040
the IN connector so that both SAIDs are in the chain.
4141
In Arduino select board "ESP32S3 Dev Module".
4242
43+
BEHAVIOR
44+
During DEMO1 and DEMO2 the first RGB (L1.0) of SAID OUT is green.
45+
For DEMO3 it switches of.
46+
4347
OUTPUT
4448
Welcome to aoosp_error.ino
45-
version: result 0.4.0 spi 0.5.0 osp 0.4.0
49+
version: result 0.4.1 spi 0.5.1 osp 0.4.1
4650
4751
spi: init
4852
osp: init
4953
54+
NOTE
55+
'mult' is used as a harmless write/read scratch register
56+
5057
DEMO1
51-
condition: CRC checking disabled | CRC trapping disabled | mult 0000 | error flags 00 | status ACTIVE
58+
condition: CRC checking disabled | CRC trapping disabled | mult 0000 | error flags 00 | status active
5259
action : setmult(1) with ok CRC
53-
condition: CRC checking disabled | CRC trapping disabled | mult 0001 | error flags 00 | status ACTIVE
60+
condition: CRC checking disabled | CRC trapping disabled | mult 0001 | error flags 00 | status active
5461
action : setmult(2) with bad CRC
55-
condition: CRC checking disabled | CRC trapping disabled | mult 0002 | error flags 00 | status ACTIVE
62+
condition: CRC checking disabled | CRC trapping disabled | mult 0002 | error flags 00 | status active
5663
observe : with 'CRC checking _disabled_' the bad setmult(2) is just accepted
5764
observe : no error flags set, status stays ACTIVE, green led stays on
5865
5966
DEMO2
60-
condition: CRC checking enabled | CRC trapping disabled | mult 0000 | error flags 00 | status ACTIVE
67+
condition: CRC checking enabled | CRC trapping disabled | mult 0000 | error flags 00 | status active
6168
action : setmult(1) with ok CRC
62-
condition: CRC checking enabled | CRC trapping disabled | mult 0001 | error flags 00 | status ACTIVE
69+
condition: CRC checking enabled | CRC trapping disabled | mult 0001 | error flags 00 | status active
6370
action : setmult(2) with bad CRC
64-
condition: CRC checking enabled | CRC trapping disabled | mult 0001 | error flags 08 | status ACTIVE
71+
condition: CRC checking enabled | CRC trapping disabled | mult 0001 | error flags 08 | status active
6572
observe : with 'CRC checking _enabled_' the bad setmult(2) is not accepted
6673
observe : an error flag is set, but status stays ACTIVE, green led stays on
6774
6875
DEMO3
69-
condition: CRC checking enabled | CRC trapping enabled | mult 0000 | error flags 00 | status ACTIVE
76+
condition: CRC checking enabled | CRC trapping enabled | mult 0000 | error flags 00 | status active
7077
action : setmult(1) with ok CRC
71-
condition: CRC checking enabled | CRC trapping enabled | mult 0001 | error flags 00 | status ACTIVE
78+
condition: CRC checking enabled | CRC trapping enabled | mult 0001 | error flags 00 | status active
7279
action : setmult(2) with bad CRC
73-
condition: CRC checking enabled | CRC trapping enabled | mult 0001 | error flags 08 | status SLEEP
80+
condition: CRC checking enabled | CRC trapping enabled | mult 0001 | error flags 08 | status sleep
7481
observe : with 'CRC checking _enabled_' the bad setmult(2) is not accepted
7582
observe : with 'CRC trapping _enabled_' the bad setmult(2) is even trapped
7683
observe : an error flag is set, status moved to SLEEP, green led switches off
@@ -184,6 +191,8 @@ void setup() {
184191
aospi_init();
185192
aoosp_init();
186193

194+
Serial.printf("\nNOTE\n'mult' is used as a harmless write/read scratch register\n" );
195+
187196
demo1();
188197
delay(2000);
189198
demo2();

examples/aoosp_group/aoosp_group.ino

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,19 @@ The demo runs on the OSP32 board. Have a cable from the OUT connector to
3333
the IN connector so that both SAIDs are in the chain.
3434
In Arduino select board "ESP32S3 Dev Module".
3535
36+
BEHAVIOR
37+
The first RGB (L1.0) of SAID OUT and the first RGB of the next SAID
38+
blink: first both red then both green then repeats.
39+
3640
OUTPUT
3741
Welcome to aoosp_group.ino
38-
version: result 0.1.10 spi 0.2.8 osp 0.2.2
42+
version: result 0.4.1 spi 0.5.1 osp 0.4.1
3943
4044
spi: init
4145
osp: init
4246
4347
reset(0) ok
44-
initloop(1) ok last 002
48+
initloop(1) ok last 009
4549
clrerror(0) ok
4650
goactive(0) ok
4751
setmult(1,grp5) ok
@@ -50,9 +54,6 @@ setmult(2,grp5) ok
5054
setpwmchn(grp5,0,red) ok
5155
setpwmchn(grp5,0,grn) ok
5256
53-
setpwmchn(grp5,0,red) ok
54-
setpwmchn(grp5,0,grn) ok
55-
5657
setpwmchn(grp5,0,red) ok
5758
setpwmchn(grp5,0,grn) ok
5859
*/

examples/aoosp_i2c/aoosp_i2c.ino

Lines changed: 48 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,24 @@ Finally it polls the INT line and shows its status on SAID1.RGB0.
3232
HARDWARE
3333
The demo runs on the OSP32 board. Have a cable from the OUT connector to
3434
the IN connector so that both SAIDs are in the chain.
35-
The OSP32 board has an I2C device (EEPROM) attached to the first SAID,
36-
and it is possible to plug in other (5V) I2C devices (like an EEPROM stick)
37-
in the I2C connector of the OSP32 board. OSP32 als has a pushbutton
38-
connected to the INT line of the SAID with I2C bridge.
35+
The SAID OUT on the OSP32 board is enabled for I2C. On the OSP32 board an I2C
36+
device (EEPROM) is attached to it. One could attach other I2C devices, like
37+
the supplied EEPROM stick, via the header labeled "I2C".
38+
The first phase of this demo, scans for all connected I2C devices on the bus
39+
(it finds at least the EEPROM). The second phase writes/reads the connected
40+
EEPROM. The OSP32 board has a pushbutton connected to the INT line of the
41+
SAID with I2C bridge. In the third phase, pressing the push button instructs
42+
the firmware to change the color of an LED.
3943
In Arduino select board "ESP32S3 Dev Module".
4044
45+
BEHAVIOR
46+
During the I2C scan or the EEPROM test, there is no visible behavior.
47+
During the third phase the first RGB (L1.0) of SAID OUT is green
48+
except while the INT button is depressed, then it is red.
49+
4150
OUTPUT
42-
(press the INT button in the third demo)
4351
Welcome to aoosp_i2c.ino
44-
version: result 0.1.7 spi 0.2.4 osp 0.1.16
52+
version: result 0.4.1 spi 0.5.1 osp 0.4.1
4553
spi: init
4654
osp: init
4755
@@ -58,7 +66,7 @@ Bus scan for SAID 001
5866
38: 38 39 3a 3b 3c 3d 3e 3f
5967
40: 40 41 42 43 44 45 46 47
6068
48: 48 49 4a 4b 4c 4d 4e 4f
61-
50: [50] 51 52 53 54 55 56 57
69+
50: 50 51 52 53 [54] 55 56 57
6270
58: 58 59 5a 5b 5c 5d 5e 5f
6371
60: 60 61 62 63 64 65 66 67
6472
68: 68 69 6a 6b 6c 6d 6e 6f
@@ -68,21 +76,21 @@ SAID 001 has 1 I2C devices (see square brackets)
6876
6977
resetinit last 002 loop
7078
71-
Read/write (to EEPROM 50 on SAID 001)
72-
eeprom 00 0E 49 0E 92 0E DB 0E
73-
eeprom 00 0E BE EF 92 0E DB 0E
74-
eeprom 00 0E 49 0E 92 0E DB 0E
79+
Read/write (locations 00..07 of EEPROM 54 on SAID 001)
80+
eeprom FF FF FF FF FF FF FF FF (original)
81+
eeprom FF FF BE EF FF FF FF FF (written)
82+
eeprom FF FF FF FF FF FF FF FF (restored)
7583
7684
resetinit last 002 loop
7785
78-
Polling INT pin (on SAID 001)
86+
Press INT button and check L1.0
7987
*/
8088

8189

8290
// OSP node address of the SAID to use for I2C
8391
#define ADDR 0x001 // OSP32 has SAID1 with I2C on addr 001
8492
// I2C device address
85-
#define DADDR 0x50 // OSP32 has EEPROM with this address on SAID1
93+
#define DADDR 0x54 // OSP32 has EEPROM with this address on SAID1
8694

8795

8896
// Print a table of all I2C device addresses that acknowledge a read
@@ -111,6 +119,7 @@ void i2c_scan() {
111119
// Scan all devices
112120
Serial.printf("\nBus scan for SAID %03X\n",ADDR);
113121
int count= 0;
122+
int found= 0;
114123
for( uint8_t daddr7=0; daddr7<0x80; daddr7++ ) {
115124
if( daddr7 % 8 == 0) Serial.printf("%02x: ",daddr7);
116125
// Try to read at address 0 of device daddr7
@@ -119,10 +128,12 @@ void i2c_scan() {
119128
int i2cfail= result==aoresult_dev_i2cnack || result==aoresult_dev_i2ctimeout;
120129
if( result!=aoresult_ok && !i2cfail ) { Serial.printf("i2cread8 %s\n", aoresult_to_str(result) ); return; }
121130
if( i2cfail ) Serial.printf(" %02x ",daddr7); else Serial.printf("[%02x]",daddr7); // [] brackets indicate presence
131+
if( !i2cfail && daddr7==DADDR ) found++;
122132
if( !i2cfail ) count++;
123133
if( daddr7 % 8 == 7) Serial.printf("\n");
124134
}
125135
Serial.printf("SAID %03X has %d I2C devices (see square brackets)\n", ADDR, count);
136+
if( !found ) Serial.printf("WARNING: expect I2C device with address %02X, but did find any\n",DADDR);
126137

127138
Serial.printf("\n");
128139
}
@@ -150,13 +161,22 @@ void i2c_eeprom() {
150161
result= aoosp_exec_i2cenable_get(ADDR,&enable);
151162
if( result!=aoresult_ok || !enable ) { Serial.printf("ERROR: there doesn't seem to be a SAID with I2C enabled at %03X (%s)\n",ADDR,aoresult_to_str(result)); return; }
152163

153-
Serial.printf("\nRead/write (to EEPROM %02X on SAID %03X)\n",DADDR,ADDR);
164+
//uint8_t flags, rcur, gcur, bcur;
165+
//result= aoosp_send_readcurchn(ADDR, 2, &flags, &rcur, &gcur, &bcur);
166+
//if( result!=aoresult_ok ) { Serial.printf("readcurchn %s\n", aoresult_to_str(result) ); return; }
167+
//Serial.printf("readcurchn: flags %02X rgb %02X %02X %02X\n", flags, rcur, gcur, bcur);
168+
169+
// Power the I2C bus
170+
result= aoosp_exec_i2cpower(ADDR);
171+
if( result!=aoresult_ok ) { Serial.printf("i2cpower %s\n", aoresult_to_str(result) ); return; }
172+
173+
Serial.printf("\nRead/write (locations 00..07 of EEPROM %02X on SAID %03X)\n",DADDR,ADDR);
154174
// Dump the first 8 bytes of the I2C EEPROM memory
155175
result= aoosp_exec_i2cread8(ADDR, DADDR, 0x00, rbuf1, 8);
156176
if( result!=aoresult_ok ) { Serial.printf("i2cread8 %s\n", aoresult_to_str(result) ); return; }
157177
Serial.printf("eeprom");
158178
for( int i=0; i<8; i++ ) Serial.printf(" %02X",rbuf1[i]);
159-
Serial.printf("\n");
179+
Serial.printf(" (original)\n");
160180

161181
// Modify bytes 2 and 3 of the I2C EEPROM memory
162182
wbuf[0]= 0xBE; wbuf[1]=0xEF;
@@ -168,7 +188,7 @@ void i2c_eeprom() {
168188
if( result!=aoresult_ok ) { Serial.printf("i2cread8 %s\n", aoresult_to_str(result) ); return; }
169189
Serial.printf("eeprom");
170190
for( int i=0; i<8; i++ ) Serial.printf(" %02X",rbuf2[i]);
171-
Serial.printf("\n");
191+
Serial.printf(" (written)\n");
172192

173193
// Restore bytes 2 and 3 of the I2C EEPROM memory
174194
wbuf[0]= rbuf1[2]; wbuf[1]=rbuf1[3];
@@ -180,14 +200,14 @@ void i2c_eeprom() {
180200
if( result!=aoresult_ok ) { Serial.printf("i2cread8 %s\n", aoresult_to_str(result) ); return; }
181201
Serial.printf("eeprom");
182202
for( int i=0; i<8; i++ ) Serial.printf(" %02X",rbuf2[i]);
183-
Serial.printf("\n");
203+
Serial.printf(" (restored)\n");
184204

185205
Serial.printf("\n");
186206
}
187207

188208

189209
// Poll the INT pin
190-
#define LEDADDR 0x001
210+
#define ADDR_LED 0x001
191211
void i2c_int_setup() {
192212
aoresult_t result;
193213
int enable;
@@ -210,11 +230,14 @@ void i2c_int_setup() {
210230
result= aoosp_exec_i2cpower(ADDR);
211231
if( result!=aoresult_ok ) { Serial.printf("i2cpower %s\n", aoresult_to_str(result) ); return; }
212232

213-
// Prepare SAID at LEDADDR for feedback (clear its errors and go active)
214-
result= aoosp_send_clrerror(LEDADDR);
233+
// Prepare SAID at ADDR_LED for feedback (clear its errors and go active)
234+
result= aoosp_send_clrerror(ADDR_LED);
215235
if( result!=aoresult_ok ) { Serial.printf("clrerror %s\n", aoresult_to_str(result) ); return; }
216-
result= aoosp_send_goactive(LEDADDR);
236+
result= aoosp_send_goactive(ADDR_LED);
217237
if( result!=aoresult_ok ) { Serial.printf("goactive %s\n", aoresult_to_str(result) ); return; }
238+
239+
// Instruct user
240+
Serial.printf("\nPress INT button and check L1.0\n");
218241
}
219242

220243

@@ -226,12 +249,14 @@ void i2c_int_loop() {
226249
if( result!=aoresult_ok ) { Serial.printf("readi2ccfg %s\n", aoresult_to_str(result) ); return; }
227250
uint8_t intstate= flags & AOOSP_I2CCFG_FLAGS_INT;
228251
if( intstate ) {
229-
result= aoosp_send_setpwmchn(LEDADDR, 0/*chn*/, 0x7FFF/*red*/, 0x0000/*green*/, 0x0000/*blue*/);
252+
result= aoosp_send_setpwmchn(ADDR_LED, 0/*chn*/, 0x7FFF/*red*/, 0x0000/*green*/, 0x0000/*blue*/);
230253
if( result!=aoresult_ok ) { Serial.printf("setpwmchn %s\n", aoresult_to_str(result) ); return; }
231254
} else {
232-
result= aoosp_send_setpwmchn(LEDADDR, 0/*chn*/, 0x0000/*red*/, 0x7FFF/*green*/, 0x0000/*blue*/);
255+
result= aoosp_send_setpwmchn(ADDR_LED, 0/*chn*/, 0x0000/*red*/, 0x7FFF/*green*/, 0x0000/*blue*/);
233256
if( result!=aoresult_ok ) { Serial.printf("setpwmchn %s\n", aoresult_to_str(result) ); return; }
234257
}
258+
259+
delay(1);
235260
}
236261

237262

examples/aoosp_min/aoosp_min.ino

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ Have a cable from the OUT connector to the IN connector.
3434
This demo will run alternately in BiDir and Loop mode.
3535
In Arduino select board "ESP32S3 Dev Module".
3636
37+
BEHAVIOR
38+
The first RGB (L1.0) of SAID OUT blinks bright white and dim white.
39+
First in BiDir mode (so direction mux led is green) then in loop (led is orange).
40+
Then repeats.
41+
3742
OUTPUT
3843
Welcome to aoosp_min.ino
3944
version: result 0.1.10 spi 0.2.8 osp 0.2.2

examples/aoosp_otp/aoosp_otp.ino

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
DESCRIPTION
2727
This demo reads and writes from/to the OTP (one time programmable memory)
2828
of a SAID.
29-
Note that this accesses the OTP mirror in RAM, not the actual OTP ("ROM").
29+
Enable the OTP password (ask supplier) or this example will complain
30+
WARNING: Please ask ams-OSRAM for correct TESTPW (uncomment //#include in aoosp_send.h)
31+
Note that OTP writes access the OTP mirror in RAM, not the actual OTP ("ROM").
3032
The mirror is persistent over RESET, but not over POR (power on reset).
3133
The latter requires the CUST, BURN, IDLE steps, which are beyond the scope
3234
of this example.
@@ -36,28 +38,31 @@ The demo should run on the OSP32 board.
3638
Have a cable from the OUT connector to the IN connector.
3739
In Arduino select board "ESP32S3 Dev Module".
3840
41+
BEHAVIOR
42+
Nothing to be seen, example only manipulates OTP memory.
43+
3944
OUTPUT
4045
Welcome to aoosp_otp.ino
41-
version: result 0.1.10 spi 0.2.8 osp 0.2.2
46+
version: result 0.4.1 spi 0.5.1 osp 0.4.1
4247
spi: init
4348
osp: init
4449
4550
DUMP of 001
46-
resetinit last 002 loop
51+
resetinit last 009 loop
4752
48-
otp: 0x0D: 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
53+
otp: 0x0D: 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
4954
otp: CH_CLUSTERING 0D.7:5 0
5055
otp: HAPTIC_DRIVER 0D.4 0
5156
otp: SPI_MODE 0D.3 1
5257
otp: SYNC_PIN_EN 0D.2 0
5358
otp: STAR_NET_EN 0D.1 0
54-
otp: I2C_BRIDGE_EN 0D.0 0
59+
otp: I2C_BRIDGE_EN 0D.0 1
5560
otp: *STAR_START 0E.7 0
5661
otp: OTP_ADDR_EN 0E.3 0
5762
otp: STAR_NET_OTP_ADDR 0E.2:0 0 (0x000)
5863
5964
READ/WRITE DEMO of 001
60-
resetinit last 002 loop
65+
resetinit last 009 loop
6166
6267
otp: 0x0D: 09 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
6368
10 <- 5A

0 commit comments

Comments
 (0)