Go Down

Topic: i2c protocol issues (Read 479 times) previous topic - next topic

Nicola_Menca

good morning
I have an issue with my mkr, im trying to make this board communicate with an arduino nano trough I2c with the Wire.h library but it looks like it can only be Slave, is it normal?
On the web i found this other library called VidorTwoWire but there isn't any documentation about that.
can you help me?

Limba

Some checking from Wire.h under Vidor 4000.
There is example for mater/slave with write and read funtionality.
Didn't have time to test.

If you give address when initalizing wire class then it will create slave. For master Wire.begin()


Some digging from vidor library Wire.cpp

When using wire as master you have to start and end transmission.
When calling endTrasmissionWIRE it will send buffered transmission to slave. I think this is done because we don't wan't reserve bus for too long time.

Didn't find examples of restart case where you write slave device internal address do restart for changing mode to read. Maybe this is done with endTransmissionWIRE(false) and just read transmission after that.

Nicola_Menca

Hi, I already know how to use the Wire.h library because thankfully there is enough documentation about it.
My question is: Why cant I use the Mkr vidor 4000 in Master mode while using the wire.h library?
Am I doing something wrong with the actual circuit connections or is it just not possible for that board to be master?

p.s. the circuit is very simple, just the 2 sda and scl wires connected to an Arduino NANO and pulled up by 2 resistor at 3,3V.
It worked with the mkr set up in slave mode, so i suppose the ciruit is not the problem.

Limba

#3
May 30, 2019, 01:37 pm Last Edit: May 30, 2019, 05:29 pm by Limba
OK
I try to do some master test today with vidor and nano.

Edit:
Tested with addr modified example sketch.
vidor as master reader was workig.
There was some problem that slave didn't detect that address. maybe program failure of wrong bootloader version for nano. need to use old.

Edit2:
Found also other issue from my connections.
When I was only using vidor for powering system I connected it's vcc for nano 3v3. (it seems to be USB converter 3v3 output)

To get it working was to use 2 usb for powering both or connect vidor 5V to nano 5V.
Remember to use vidor vcc for pullups that SAMD and FPGA isn't getting over 3.3v. It depends of pullup size if it damages esd protect diodes.


Go Up