I2C between Teensy 3.6 slave and ARM master

Status
Not open for further replies.

RRdae

Active member
I need to interface an ARM based microcontroller (STM32F446ZETx) with a Teensy 3.6 via I2C. The ARM controller is to serve as the master, while the Teensy will act as a slave, unifying multiple sensor inputs and passing the data to the master upon request.

The issue that I have encountered is that I am not quite sure how to initiate a request on the ARM side of things, as the developer of this particular controller is quite sparse on details. The have provided the following, publicly available, code snippet as the sole demo of i2c communication (in this case, to read from an EEPROM):
Code:
uint8_t addr = 0b1010000; // 7-bit slave address
ioctl(I2C_USER_FILENO, IOCTL_CMD_RD, &addr);
uint8_t toSend[] = { 0xFA }; // command byte (to send). In this case it is the register address to read
write(I2C_USER_FILENO, (char *)toSend, 1);

// The EEPROM contains an EUI48 MAC address at this location
uint8_t mac[6];
read(I2C_USER_FILENO, (char *)mac, 6);

I have attempted to initiate a request to the Teensy slave by using the address defined on the slave (0x66), but I cannot get the Teensy slave to recognize the request. I believe this has to do with the command byte that the mfrg references in the code above, in which case I have no idea what to do with this, as I have never used a non-Teensy master in I2C. Is there a particular command byte that a Teensy expects before recognizing an I2C request?

Any advice on this would be appreciated, Thanks!
 
1: Maybe use an oscilloscope or logic analyzer to watch the SDA & SCL pins.

2: Perhaps use a Teensy 3.6 instead of that STM32 chip? They you'll have good software support. :)
 
@tonton81
For Teensy to Teensy, I use external pull up resistors (1kohm was doing ok). I did the same with the STM32, but when I probed just the I2C (with the pull up disconnected), it was holding at 3.3v, so I think the STM32 board has pull up resistors built in, ones that I cannot control at this point...

@PaulStroffregen
Thank you, I had completely forgotten about my scope. I scoped it both Teensy to Teensy (where i2c works fine) and STM32 to Teensy (where I2C does not work). From what I can tell, there is either an issue with the STM32 board or the code on the STM32, not with the Teensy.

2: Perhaps use a Teensy 3.6 instead of that STM32 chip? They you'll have good software support.
You have NO idea how much I wish I could. We paid thousands of $ for this [STM32 based] system, hoping to speed development, but the OEM has locked down the programming so much that the ability to customize it beyond their original use is virtually non-existant. As there are more components than just a main board, I cannot easily swap in a Teensy. Alas, I wish I would have built the system from the ground up around something like a Teensy, but we THOUGHT that would be the more time intensive option...


As it stands right now, I am confident in saying that the Teensy is not the problem here. There is something fishy going on with the STM32 main board or its program. I have submitted [another] request to their tech support site and am going to go have a beer before I launch into the mother of all curse rants regarding that manufacturer...

Thank you guys for your suggestions.
 
Status
Not open for further replies.
Back
Top