Search found 923 matches

by mnfisher
Mon Jun 03, 2024 8:58 pm
Forum: User Components
Topic: 2 Arduino I2C communication
Replies: 25
Views: 428

Re: 2 Arduino I2C communication

LabNation_Screenshot30.png
LabNation_Screenshot30.png (258.17 KiB) Viewed 14 times

Sending a string 'abcd\r\n\0' and requesting and receiving 5 bytes
by mnfisher
Mon Jun 03, 2024 8:50 pm
Forum: User Components
Topic: 2 Arduino I2C communication
Replies: 25
Views: 428

Re: 2 Arduino I2C communication

Okay - I made a slightly modified example Here the 'master' program (mst.fcfx running on the Mega) transmits a data string to the 'slave' (slv.fcfx running on a Nano). The string - 'abcd\r\n' rotates on each send (next is 'bcda\r\n' then 'cdab\r\n' etc) to add bit of interest. The slave receives the...
by mnfisher
Sun Jun 02, 2024 9:08 pm
Forum: User Components
Topic: 2 Arduino I2C communication
Replies: 25
Views: 428

Re: 2 Arduino I2C communication

LabNation_Screenshot28.png
LabNation_Screenshot28.png (259.42 KiB) Viewed 43 times
by mnfisher
Sun Jun 02, 2024 9:06 pm
Forum: User Components
Topic: 2 Arduino I2C communication
Replies: 25
Views: 428

Re: 2 Arduino I2C communication

Did you try the interrupt version? - I've had it running all day (I was out) - and it has not missed a beat. Also - being interrupt driven means that the slave doesn't have to busy wait on the i2c status. The master controls the data transfer (send and receive!) - and inter-mcu communication is good!
by mnfisher
Sat Jun 01, 2024 11:28 pm
Forum: User Components
Topic: 2 Arduino I2C communication
Replies: 25
Views: 428

Re: 2 Arduino I2C communication

A bit more playing and I almost got it to work by tweaking the CAL_I2C file - but it would work for one time and then stop. After a bit more fiddling - no joy. So - I rewrote the slave side using the TWI interrupt to handle receipt and sending of data. This worked remarkably easily - so here is a ve...
by mnfisher
Fri May 31, 2024 9:01 pm
Forum: User Components
Topic: 2 Arduino I2C communication
Replies: 25
Views: 428

Re: 2 Arduino I2C communication

Another step forward :-)

The RTC is acting as a slave device. Could maybe look at the output for this and see what/how it varies?
by mnfisher
Fri May 31, 2024 8:46 pm
Forum: User Components
Topic: 2 Arduino I2C communication
Replies: 25
Views: 428

Re: 2 Arduino I2C communication

Another 'oddity' - when writing m->s there is an ~18us delay between bytes. On receiving s->m there is a much shorter 'gap' (~8us) and adding a delay after each byte is transmitted doesn't affect this as expected - adding a 1ms delay gives 2 bytes with first value (and a 8us delay between them) then...
by mnfisher
Fri May 31, 2024 8:09 pm
Forum: User Components
Topic: 2 Arduino I2C communication
Replies: 25
Views: 428

Re: 2 Arduino I2C communication

Looking at your screenshot - after the 'receive' SDA stays low which holds the i2c bus as 'busy' - and prevents further transmission. If you look at the trace I posted - you can see that SDA goes high again after the 'read' It might be a slightly different board - could you try a pull-up resistor on...
by mnfisher
Fri May 31, 2024 7:35 pm
Forum: User Components
Topic: 2 Arduino I2C communication
Replies: 25
Views: 428

Re: 2 Arduino I2C communication

It is very odd = what hardware are you testing on? As you can see from my screenshot it had counted up quite a few iterations when I took it? Can you 'disable' the 'Read' in the sender (master - will perhaps have to think again about the naming!) Iain - can you remember what you got returned by the ...
by mnfisher
Thu May 30, 2024 9:26 pm
Forum: User Components
Topic: 2 Arduino I2C communication
Replies: 25
Views: 428

Re: 2 Arduino I2C communication

I've had one step forwards and one 'to the side' So - having ascertained that transmit works AOK (for me :-) ) I rewrote the code to use the I2C CAL component and transactions )notice how this makes the code for the master much simpler) I also just use the scope here (and as smartscope has decided t...