i2c almost working for me, was Re: i2c still not working for me

Daniel Braniss danny at cs.huji.ac.il
Thu Apr 11 06:56:27 UTC 2019


if no device is connected, I2CRDWR hangs, 
it also happens with i2c(8) -s, only reboot helps.

ichb1: twsi_reset: Using IIC_FASTEST/UNKNOWN mode with speed param=2a
iichb1: TWSI_WRITE: Writing 0 to 18
iichb1: TWSI_WRITE: Writing 2a to 14
iichb1: TWSI_WRITE: Writing 40 to c
iichb1: TWSI_WRITE: Writing c4 to c
iichb1: twsi_transfer: transmitting 2 messages
iichb1: TWSI_READ: read f8 from 10
iichb1: twsi_transfer: status=f8
iichb1: twsi_transfer: msg[0] flags: 0
iichb1: twsi_transfer: msg[0] len: 9
iichb1: TWSI_WRITE: Writing e4 to c

and now it’s hung



> On 10 Apr 2019, at 11:19, Daniel Braniss <danny at cs.huji.ac.il> wrote:
> 
> 
> 
>> On 9 Apr 2019, at 20:16, Oleksandr Tymoshenko <gonzo at bluezbox.com> wrote:
>> 
>> Daniel Braniss (danny at cs.huji.ac.il <mailto:danny at cs.huji.ac.il>) wrote:
>>> 
>>> 
>>>> On 9 Apr 2019, at 10:58, Emmanuel Vadot <manu at bidouilliste.com> wrote:
>>>> 
>>>> On Tue, 9 Apr 2019 10:50:22 +0300
>>>> Daniel Braniss <danny at cs.huji.ac.il> wrote:
>>>> 
>>>>> Hi,
>>>>> after the latest changes to i2c there is a small improvement,
>>>>> i2c -s finds the device but complains:
>>>>> 
>>>>> root at neo-14:~ # i2c -s
>>>>> Hardware may not support START/STOP scanning; trying less-reliable read method.
>>>>> Scanning I2C devices on /dev/iic0: 24
>>>>> 
>>>>> but nothing else works.
>>>>> 
>>>>> I?ll try and connect my saleae signal analyzer later, but  in the meantime this is what I get
>>>>> on the console:
>>>>> [?]
>>>>> iichb0: twsi_control_clear: read val=58
>>>>> iichb0: twsi_control_clear: write val=40
>>>>> iichb0: TWSI_WRITE: Writing 40 to c
>>>>> iichb0: twsi_start: twsi_start: slave=48
>>>>> iichb0: twsi_locked_start: send start
>>>>> iichb0: TWSI_READ: read 58 from c
>>>>> iichb0: twsi_control_set: read val=58
>>>>> iichb0: twsi_control_set: write val=68
>>>>> iichb0: TWSI_WRITE: Writing 68 to c
>>>>> iichb0: twsi_poll_ctrl: Waiting for ctrl r.
>>>>> eg to match mask 8
>>>>> iichb0: TWSI_READ: read 48 from c
>>>>> gic0: iichb0: Spurious interrupt detected: last irq: 32 on CPU1
>>>>> twsi_poll_ctrl: done
>>>>> gic0: iichb0: Spurious interrupt detected: last irq: 32 on CPU1
>>>>> TWSI_READ: read 8 from 10
>>>>> iichb0: twsi_locked_start: status=8
>>>>> iichb0: TWSI_WRITE: Writing 48 to 8
>>>>> gic0: Spurious interrupt detected: last irq: 32 on CPU1
>>>>> iichb0: TWSI_READ: read 48 from c
>>>>> gic0: iichb0: Spurious interrupt detected: last irq: 32 on CPU1
>>>>> twsi_control_clear: read val=48
>>>>> gic0: iichb0: Spurious interrupt detected: last irq: 32 on CPU1
>>>>> twsi_control_clear: write val=40
>>>>> gic0: iichb0: Spurious interrupt detected: last irq: 32 on CPU1
>>>>> TWSI_WRITE: Writing 40 to c
>>>>> gic0: Spurious interrupt detected: last irq: 32 on CPU1
>>>>> iichb0: twsi_poll_ctrl: Waiting for ctrl reg to match mask 8
>>>>> gic0: iichb0: Spurious interrupt detected: last irq: 32 on CPU1
>>>>> TWSI_READ: read 48 from c
>>>>> iichb0: twsi_poll_ctrl: done
>>>>> iichb0: TWSI_READ: read 8 from 10
>>>>> iichb0: twsi_locked_start: no ACK (status: 08) after sending slave address
>>>>> gic0: iichb0: Spurious interrupt detected: last irq: 32 on CPU1
>>>>> twsi_stop: twsi_stop
>>>>> [?]
>>>>> 
>>>>> BTW, the hardware is NanoPi-neo and it?s running Current 345984
>>>>> 
>>>>> thanks,
>>>>> 	danny
>>>>> 
>>>> 
>>>> Based on the function names you are using directly stop/start/etc ...
>>>> My changes were only for i2c_transfer (I2CRDWR ioctls)
>>>> 
>>> 
>>> ok, this will show my ignorance, but could you send me some sample code that uses I2CRDWR?
>>> btw, the device i’m trying out is an RFID reader pn533, which works with a modified driver …
>> 
>> Sample code for TMP102 sensor that uses RDWR ioctl:
>> 
>> https://github.com/gonzoua/freebsd-embedded-demos/blob/master/libtmp102/tmp102.c <https://github.com/gonzoua/freebsd-embedded-demos/blob/master/libtmp102/tmp102.c>
> 
> 
> thanks gonzo!
> I already got to talk to the PN533, so the iic driver is now working,
> now for some more coding (the pn533 is a bit more complicated than the thermal chip :-)
> thanks,
> 	danny
> 
> 
>> 
>> 
>> -- 
>> gonzo
> 
> _______________________________________________
> freebsd-arm at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-arm
> To unsubscribe, send any mail to "freebsd-arm-unsubscribe at freebsd.org"



More information about the freebsd-arm mailing list