modelI2cIrq
Extends from Modelica.Icons.Example (Icon for runnable examples).
Information
Same electrical I2C bus as Examples.MultiMcu.I2c, but board B (i2c_target_irq.py) answers commands from an IRQ handler instead of exposing a memory. Board A (i2c_controller_irq.py) writes a command, then reads the reply: ID gives MCU-B, CNT gives the number of commands received so far.
In the handler of B, IRQ_END_WRITE means that the command is complete (B reads it with readinto()), and IRQ_READ_REQ that the controller wants a byte while none is queued (B queues the reply with write()). The handler runs at the same simulated instant as the event: the reply is sent at once, without the clock stretching that a real target would need. A sets its GP7 high if the three replies are right.
Components
| Type | Name | Default | Description |
|---|---|---|---|
| MCU | mcuA | Controller: Resources/Scripts/MCU/i2c_controller_irq.py (SCL = GP4, SDA = GP5) | |
| MCU | mcuB | Target at 0x43: Resources/Scripts/MCU/i2c_target_irq.py (SCL = GP4, SDA = GP5) | |
| Modelica.Electrical.Analog.Basic.Ground | ground | ||
| Modelica.Electrical.Analog.Sources.ConstantVoltage | vdd | 3.3 V supply of the pull-up resistors | |
| Modelica.Electrical.Analog.Basic.Resistor | pullScl | pull-up of SCL: an I2C bus only rises through its pull-ups | |
| Modelica.Electrical.Analog.Basic.Resistor | pullSda | pull-up of SDA |