EmbDev.net

Forum: µC & Digital Electronics configure INTA and INTB on MCP23017 using cmd call i2cset


von Dieter S. (ids2001)


Rate this post
useful
not useful
I am struggling to configure my MCP23017 with pure cmd line calls from 
i2cset and i2cget on the lastest Raspberry Pi 4.

Since this is an requirement to use pure cmd line calls, neither C or 
Python or whatever API is allowed.

What I have done so far:

Device has an I2C address like: 0x20
1
i2cset -y 1 0x20 0x00 0xff
2
Set all pins from PORT A to inputs. 
3
i2cset -y 1 0x20 0x02 0xff     
4
enabled it for all pins
5
i2cset -y 1 0x20 0x03 0x00     
6
set the default compare register to 0 because I want to trigger an INT if value changes to 1 on input pins
7
i2cset -y 1 0x20 0x04 0x00     
8
mhmm I am bit lost already - would think that this must also bei 0x00 for all pins?!

BUT if I change the logical level on the pins from PORT A (all pins are 
set to active low by external resistor) from LOW to HIGH (and vice 
versa) nothing is happening.

I don't know why - has anyone an idea what I am doing wrong here?

Many thanks
Cheers Dieter

von wendelsberg (Guest)



Rate this post
useful
not useful
Dieter S. wrote:
> Device has an I2C address like: 0x20

The base address (opcode) of the MCP23017 is 0x40, not 0x20.

wendelsberg

von Dieter S. (ids2001)


Rate this post
useful
not useful
I got it working couple of hours after I wrote the first thread.
1
#!/bin/bash
2
deviceAddr=0x20 #I2C device address
3
GPINTENA=0x04   # Port A interrupt register.
4
DEFVALA=0x06    # Port A default values.
5
INTCONA=0x08    # Port A interrupt control.
6
7
i2cset -y 1 $deviceAddr $DEFVALA 0x00 
8
sleep 0.5
9
i2cset -y 1 $deviceAddr $INTCONA 0x00 
10
sleep 0.5
11
i2cset -y 1 $deviceAddr $GPINTENA 0xff  
12
sleep 0.5

von Dr. MCU (Guest)


Rate this post
useful
not useful
wendelsberg wrote:
> Dieter S. wrote:
>> Device has an I2C address like: 0x20
>
> The base address (opcode) of the MCP23017 is 0x40, not 0x20.
>
> wendelsberg

Bullshit, as you can see in your image. The address is 0x20-0x27.

von Dieter S. (ids2001)


Rate this post
useful
not useful
oh little boy dont be like a diva :)

von Veit D. (devil-elec)


Attached files:

Rate this post
useful
not useful
Hello,

you surely want the pin change interrupt. I can't see any difference to 
my code for now.

delete INTCON
set INTEN

Does your I2C code for the bus work at all?

An excerpt of my lib. I do not do it differently.

von https://www.ginza78.com/repurika-11614.html (Guest)


Rate this post
useful
not useful
梱包の丁寧さに驚きました。形が崩れないように多くの梱包材を入れて頂き、梱包材に貼ってあるテープも開封し易いように、まるでデパートの包装のように全 
て端を折り返してありました。「返品可能」とのことでしたので、万が一の返品の際にも再包装しやすいようにとの配慮だと思われます。
お店の心遣いが伝わり、送料込のこの料金では申し訳ないと思うほどでした。
引き続きこのお店でと思い、ショルダーバッグも購入しました。
同じく丁寧な梱包で大満足です。
【送料無料】コーチ ワンショルダーバッグをセール価格で販売中♪コーチ ワンショルダーバッグ シグネチャー 6091 ピンク ブラウン キャンバス 
レザー 新品 コーチ
丁寧な梱包
初めて新品を購入しました。
新品の状態のレベルの判断に個人差があるので、心配しながらの購入でしたが、とてもきれいな状態で満足です。

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.