[PD] [pii2c] keeps and resends previous messages when addresses change

Martin Peach chakekatzil at gmail.com
Sat Sep 12 22:02:35 CEST 2020


On Thu, Sep 10, 2020 at 2:25 PM Alexandros <adrcki at gmail.com> wrote:
>
> When trying to send messages to two I2C slaves from the Pi with [pii2c]
> the following happens:
>
> If I send this message to [pii2c 0x0A]:
> "write 3 127 7"
>
> it arrives properly at the slave address 0x0A.
>
> If I change the address to 0x09 with the message "addr 0x09" and then
> send this message:
> "write 97"
>
> then both messages will be sent to the respective slaves, meaning that
> "3 127 7" will be sent to slave 0x0A and "97" to slave 0x09. If I then
> change the message sent to 0x09 to "98", this will be sent to 0x09, but
> again "3 127 7" will be sent to 0x0A. If I resend "3 127 7" to 0x0A,
> "98" (the last message set to 0x09) will be sent to 0x09 as well.
>
> The same behavior occurs when I send the message "write 0x09 98". The
> same behavior also occurs if I use two different [pii2c] objects, like this:
>
> [write 3 127 7(
> |
> [pii2c 0x0A]
>
> [write 97(
> |
> [pii2c 0x09]
>
>

Hmmm I don't get this. Do you have a patch that will reproduce the bug?
(I am also able to send messages longer than 32 bytes, with
MAX_I2C_BUF_SIZE 64 in my copy of pii2c.c.)
I used a teeny 3.2 as a slave (using i2c_t3 from
https://github.com/nox771/i2c_t3) listening on all addresses. It only
receives the messages on the addresses I set in the Pd patch.

Perhaps you have a hidden [pii2c 0x0A] somewhere that is also
receiving your write messages.
Since [pii2c] is using the same memory space for each message any new
message will effectively erase the old ones, so it's hard to explain
two different messages coming from a single object.

Martin





More information about the Pd-list mailing list