Tutorial: Access the I2C Bus on any Desktop PC (The SMBus)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
how do you normally access ice qrc devices are you using a raspberry pi or an arduino or a microcontroller well today i will show you how you can use a standard desktop pc with a pci express slot to access any is4c devices and for this purpose i will control this bmp 280 temperature sensor over this old desktop pc before i start to use a small warning please don't use your 1000 euro workstation or gaming pc to reproduce what i'm doing in this video here because there is the danger to short wire some voltages and this could damage your motherboard or in the worst case destroy your your whole pc and this is why i'm using this quite old pc because if i break something here the damage is not too big so if you are trying to reproduce what i show i'm showing you in this video please make sure you know what you're doing and please make sure you don't short wire any voltages which could damage your computer but with this out of the way let's start so i've already told you we'll need an pci express port to access an iscroc device and so here i'm on the pci express wikipedia article and if we look at the pin out of a pci express connector we can see the pin out here and up here we have some voltage and ground pins down here we have the pins which are required for transmitting and receiving data over pci express but up here is the interesting part here we have a sm bus and jtag port pins and the sm bus are these two pins here sm clock sm data and this looks kind familiar kind of familiar like the ice cream c bus so let's go and dig in a little bit deeper if i go to the the wikipedia article of the sm bus we can see the system management bus as mbus is a single-ended simple two-wire bus for the purpose of lightweight communication it is sterile wired from isqrc for communication with low bandwidth devices on a motherboard so actually sm bus is compatible with iscro c bus ok there are some small exceptions but overall you can use an iscroc device over the sm bus and that is great so how can we achieve this so if you look here you can see i have a pci express connection cable or extension cable and i have modified it a little bit so here you can see the original cable and i have removed this pci express slot and i have made some new connections so here i took pin 5 of side b which is sm clock and connected it to serial clock of my i square c device a bmp 280 temperature sensor then i took sm that also assembles data and connected it to the iscroc device serial data pin and i could i did the same for ground i connected ground to my bmp 280s ground pin and i connected 3.3 volts to the power supply pin of my sensor and because we can see this in this video quite badly i have a better picture which will show you the connections so here it is you can see it's the same pc and here you can see my modified pci express extension cable i took these four pins and soldered this pin header to it and with jumper cables i have connected my bmp 280 temperature sensor to it so the last pin here is 3.3 watts and i've connected to the faucet pin of my bmp280 the blue wire here is ground which is connected to ground of the bmp 280. sdc is connected to the first pin here which is smbus clock and then we have serial data which is connected to this pin here okay so now let's test it for this purpose i've connected to my pc here over ssh and the first room we have to check is if our pc has a smbus controller so let's run lspci and here we can see this device here is our smbus controller so this emboss controller is from the nvidia corporation yeah but never mind then you need the ice4c tools you can install them for example on debian base this show with app install i square c tools i think yeah this should install them but they are already installed here on my system and if i run assemble ms pin i square c detect and give it the minus l option it will list all the available buses but there are no available buses the reason for this is we have to load some kernel modules to actually access the sm bus so i will use mod probe i square c dev and mob probe i square c minus sm bus and now if i run sqc detect again you can see i have five buses available now and two buses are actually labeled with sm bus and you can see here for linux this are are just i square c controller and now we can take these device files for example we have them here is c one or yeah we have them here and we could just open these files and use them as normal i square c controllers i've actually made a video how you can access the ice cream c bus with a c program and i will put the link into the description and with this mechanisms you can also access the sm bus now but for today i will use the bash tools provided by sqrc tools to access the sensor but for this i will need the data sheet of the bmp 280 first so let me search for the data sheet okay yeah here it is and i need the memory map yeah okay so here we have the memory map it's a little bit small but i hope you can read it and we see here register d0 contains the chip id which should be 48 hexadecimal so now let's try to read the chip id or first let's scan our bus to look for this device sorry i'm a little bit too fast so i know this slot here is connected to sm bus 1 here yeah we can see this here is the address of our bmp 280 sensor you don't believe me well i have just disconnected the serial data pin and now we'll run it again and you can see this divisor is gone and if i reconnect it and run iscsi detect again here we can now see the device again okay now let's access the registers of the bmp280 sensor for this i will use ask for c get i want to use i score c1 and i want to read from the device of c address 7 6 and i want to read the register d0 and this is 58 xdtimo and that's just the result value we can find here in the datasheet okay this config register at address f5 should be writeable or yeah so first let's read it so okay currently here we have the value 2 in here because i've already played around a little bit here the reset value should be zero but if i now write a value to it with i screw c set and that's right 7 1 to it for example 071 could be copy pad let's write 7 0 to it and let's read it back we can now see it has the value seven zero here and maybe one more right two yeah f5 yeah now we have the two here okay so we could successfully access an iscsi device by using the sm bus of a standard desktop pc so the next time you have an escrow cty's don't use a raspberry pi use your standard desktop computer instead no just kidding use whatever suits you best okay so i guess that's it for today i hope you've enjoyed the video and learned something um if you want to support my work you can buy my coffee on buy my coffee.com slash johannes for linux and i guess that's it for today thanks for watching and goodbye
Info
Channel: Johannes 4GNU_Linux
Views: 14,448
Rating: undefined out of 5
Keywords:
Id: 3BXkVnz8vNo
Channel Id: undefined
Length: 9min 55sec (595 seconds)
Published: Thu May 05 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.