Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

Simulide 0.4.15 I2C question

2 posters

Go down  Message [Page 1 of 1]

1Simulide 0.4.15 I2C question Empty Simulide 0.4.15 I2C question Thu Oct 06, 2022 11:13 pm

feri



I'm doing tests with I2C taking a cue from existing components.
It happens to me that the readByte () function works but writeByte () doesn't respond (I thought it answered automatically) while startWrite () works which I don't know what it is for.
If you can help me, thank you
Greetings

2Simulide 0.4.15 I2C question Empty Re: Simulide 0.4.15 I2C question Fri Oct 07, 2022 1:57 am

arcachofo

arcachofo

but writeByte () doesn't respond (I thought it answered automatically) while startWrite () works which I don't know what it is for.
Have a look at src/simulator/elements/logic/e.i2c.cpp lines 211 and 215.

3Simulide 0.4.15 I2C question Empty Re: Simulide 0.4.15 I2C question Mon Oct 17, 2022 8:50 pm

feri



To understand i2c I tried to bring the DS1621 Simulide 0.4.15 component.
I made the comparison with the other i2c components (R / W) and I feel okay, but it doesn't work , the DS1621 :: writeByte () function does not start.
If you have some time to take a look, I am attaching the code.
Thank you
Greetings
Attachments
Simulide 0.4.15 I2C question Attachmentds1621.zip
You don't have permission to download attachments.
(5 Kb) Downloaded 2 times

4Simulide 0.4.15 I2C question Empty Re: Simulide 0.4.15 I2C question Tue Oct 18, 2022 4:22 am

arcachofo

arcachofo

Have a look at src/simulator/elements/logic/e.i2c.cpp line 208:
Code:
    if( m_rxReg == m_address ) {            // Address match
        if( rw ) {                      // Master is Reading
            m_state = I2C_READING;
            writeByte();
        } else {                        // Master is Writting
            m_state = I2C_WRITTING;
            m_bitPtr = 0;
            startWrite();
        }
        ACK();
    }

writeByte() is called after an Address match when Master is reading.
If writeByte() is not called it is because there is no Address match and/or Master is not reading.

You should debug the program and add breakpoints to see what is actually happening.

5Simulide 0.4.15 I2C question Empty Re: Simulide 0.4.15 I2C question Tue Oct 25, 2022 8:29 pm

feri



The problem was the Arduino sketch by modifying some lines it works.
It also works on another "Pr0e3u5" simulator, it didn't work before.
The problem is that now it doesn't work on Simulide 1.0.1,
I attach the old and new sketches.
Taken from here
Greetings
Attachments
Simulide 0.4.15 I2C question Attachmentds1621.zip
You don't have permission to download attachments.
(3 Kb) Downloaded 2 times

6Simulide 0.4.15 I2C question Empty Re: Simulide 0.4.15 I2C question Wed Oct 26, 2022 12:03 pm

arcachofo

arcachofo

7Simulide 0.4.15 I2C question Empty Re: Simulide 0.4.15 I2C question Wed Oct 26, 2022 3:21 pm

feri



In release 1376 both sketches do not work.
Greetings

8Simulide 0.4.15 I2C question Empty Re: Simulide 0.4.15 I2C question Wed Oct 26, 2022 4:55 pm

arcachofo

arcachofo

In release 1376 both sketches do not work.
Both are working for me.
They use different pins for LCD connection, maybe related to this.

9Simulide 0.4.15 I2C question Empty Re: Simulide 0.4.15 I2C question Wed Oct 26, 2022 8:19 pm

feri



Sorry it's true they both work.
Greetings

arcachofo likes this post

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum