Spark Logic

i2cscanner single device, multiple device addresses

zmemw16 Tue Aug 18, 2015 9:08 pm

i’m trying to talk to the i2c at24c08 built into the board which is a
STM32F103ZET6 Minimum System Development Board ARM STM32 Cortex-m3 M75
from
http://www.ebay.co.uk/itm/291305557264? … EBIDX%3AIT

i2c scanner(from examples) shows this

Scanning…
I2C device found at address 0x50
I2C device found at address 0x51
I2C device found at address 0x52
I2C device found at address 0x53
done

the device address is known to be 0x50, so is this just bad address decoding or is it really returning 4 devices?
i’m inclined to the former:-)

the data sheet says single address and im trying to write and then read back from a location; mention is made of
a ‘repeated start.

so my code
int data;
#define Trigger PB3

void setup() {
pinMode(Trigger, OUTPUT);
digitalWrite(Trigger, LOW);
Serial.begin(115200);
Wire.begin();
}

void loop() {
digitalWrite(Trigger, HIGH); // ols trigger
Wire.i2c_start();
Wire.i2c_shift_out(0x50); // device address
Wire.i2c_get_ack();
Wire.i2c_shift_out(0x5a); // writing data to this address
Wire.i2c_get_ack();
Wire.i2c_shift_out(0xa5); // write data
Wire.i2c_get_ack();
Wire.i2c_stop();
delay(5);
Wire.i2c_start();
Wire.i2c_shift_out(0x50); // device address
Wire.i2c_get_ack();
Wire.i2c_shift_out(0x5a); // writing data to this address
Wire.i2c_get_ack();
data = Wire.i2c_shift_in(); // write data
Wire.i2c_get_ack();
Wire.i2c_stop();
digitalWrite(Trigger, LOW); //
delay(5);
}

Replies

zmemw16 Fri Aug 21, 2015 3:20 am

my dad, was a mechanical engineer who used to acquire tools usually ancient ones; me, a non-practised mech eng
who went the computers, software and hardware interfaces route – i seem to be collecting assorted electronics.
keep me from too much tv couch in the long winter evenings:-)
so i have one or two 3.2 & other sizes tft lcd + touch + sd as well

actually i was looking at cubemx as it occurs to me that at some point these ‘enhanced’ boards need to be made usable and how do we in effect reverse engineer the ‘addressing’ of the enhancements.

thoughts from the variation of lcd connectors i’ve got so far,
i’ve got to find some 40 pin ide cables, extra long and with three connectors.
what would really make it easier would be port wide operations, 8 & 16 bits; maybe that already exists?
maybe a way of merging ‘bits’ such that you could read/write 8 or 16 bits hiding the way they might be split up
pa0-pa3, pb4-pb7, pc0, pc3, pd4-pd9 sort of thing.
my excuse is it’s 0415
stephen

RogerClark Fri Aug 21, 2015 3:57 am

It is possible to do a port wide write, but there isnt an API for it

You’d need to write to the output data register, but its really easy, I think its something like

GPIOA->dev->odr = 0x1234;

Sign in to reply