06-06-2021 08:31 PM
I'd like to add a thermistor input an an analog output to my RPi. It looks like if I went I2C I'd have to use a third party library right? On the other hand, I should be able to bit bang out a SPI signal right? Has anyone gone down this path or is everyone trying to do their communications with libraries? Is there an obvious disadvantage to bit banging I'm missing?
Solved! Go to Solution.
06-07-2021 02:35 AM - edited 06-07-2021 02:35 AM
I'm wondering if you are using the wrong term here. Bitbanging means generally to use one or more digital pins and simply bang the protocol out over them yourself by setting the digital IO yourself.
But why would you want to do that? (Other than as an educational exercise!).
The Raspberry Pi has two SPI ports, one of them "/dev/spidev0.1" is standard also supported by the Linx Library in LabVIEW. No need to bitbang anything if you can use this supported SPI port.
Maybe you rather mean sending commands yourself over SPI rather than using a ready made (C) library for your sensor. That is something that all the Linx examples do anyhow, that deal with an SPI peripheral. Same about the I2C examples.
06-07-2021 06:04 AM
Hey nanocyte,
i'd like to add somethings on what rolfk said.
You can use I2C without third party libraries.
I usually recommend those with doubt on using I2C to look at datasheet and libraries because it may be easier to understand what is written in the datasheet through an example inside library (for arduino in example).
I have posted in this forum community some examples on how i do such things (since i am not profficient on i2c and even LabVIEW).
we are all learning every day something new.
06-07-2021 11:07 AM
Thank you for the tips. I did not realize there was support for SPI without using a third party .so. I saw so many other people in the forum trying to compile their own library but maybe they were doing something else. Is there also I2C support? Can you point me to an example (especially if it has the correct pins hard coded)? Many of the examples are targeting the Arduino targets and it's tough to cut through that "noise"
06-07-2021 01:50 PM - edited 06-07-2021 01:56 PM
Yes, Linx also has I2C support.
Here is a I2C example Youtube video. I can't vouch for it as my work with Linx so far has been not really about accessing peripherals but rather in the Linx shared library itself.
The problem I see mostly here is that people think it's all LabVIEW plug and play, but that is not how this works. Linx is a building block that lets you control the I2C or SPI bus on a supported device. But how to connect your particular ADC, PWM, Temp measurement sensor or whatever to the right IO pins is something that will often vary depending on the protocol, used chip and needs to be extracted from the datasheet for that chip, and with a basic understanding of the I2C or SPI communication interface on hardware electronics level. And to program it you again need to read the datasheet and figure out which bits and bytes need to be send over the line to address your specific chip.
06-07-2021 01:53 PM
@rolfk escreveu:
Linx is a building block that lets you control the I2C or SPI bus on a supported device. But how to connect your particular ADC, PWM, Temp measurement sensor or whatever to the right IO pins is something that will often vary depending on the protocol, used chip and needs to be extracted from the datasheet for that chip, a basic understanding of the I2C or SPI communication interface on hardware electronics level. And to program it you again need to read the datasheet and figure out which bits and bytes need to be send over the line to address your specific chip.
This should be pinned in the Hobbyist Toolkit forum home page