PowerShell / PowerShell-IoT

Interact with I2C, SPI & GPIO devices using PowerShell Core!
https://www.powershellgallery.com/packages/Microsoft.PowerShell.IoT
MIT License
129 stars 28 forks source link

Combining Device Address & Start Command ADS 1115 #70

Open urPlaceOrMine opened 1 year ago

urPlaceOrMine commented 1 year ago

Prerequisites

Steps to reproduce

When using the PS IOT module to communicate with the TI ADS 1115 TI ADS 1115 Documentation on the i2c bus the commands on the module are not activating the module and the conversation is not starting with the chip. I think it is because the chip is expecting a START command after the REGISTER call to initiate the conversation.

$device = Get-i2cDevice -Id 0x48 $device Returns ID 72 & BUSID 1 Get-i2CRegister -Device $device -Register 0x01 2 Returns Device 72, Register 1, Data 133,131.

I need to change the first data bit from 133 to 132 to start a continuous conversation.

If I use the -passThru command with set the chip is returning the changed values. However a subsequent query show the same 133, 131. > Set-I2CRegister -device $device -Register 0x01 -data 132, 131 -passthru returned: Device Register Data


72 1 {132, 131}

But Get-I2CRegister -Device $device -register 0x01 2 returns: Device Register Data


72 1 {133, 131}

Expected behavior

Set-I2CRegister -device $device -Register 0x01 -data 132, 131 -passthru`
and
'Get-I2CRegister -Device $device -register 0x01 2'
should return
Device Register Data
------ -------- ----
72            1 {132, 131}

Actual behavior

Set-I2CRegister -device $device -Register 0x01 -data 132, 131 -passthru`
and
'Get-I2CRegister -Device $device -register 0x01 2'
should return
Device Register Data
------ -------- ----
72            1 {133, 131}

Error details

Get-error no error is returned.

Environment data

PS /home/pi> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.2.5
PSEdition                      Core
GitCommitId                    7.2.5
OS                             Linux 5.15.32-v7+ #1538 SMP Thu Mar 31 19:38:48…
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Version

7.2.5

Visuals

na