Comments on: Chapter 8: Interfacing to the Raspberry Pi Buses https://www.exploringrpi.com Companion Site for the book Exploring Raspberry Pi Fri, 27 Apr 2018 02:56:25 +0000 hourly 1 https://wordpress.org/?v=5.0.1 By: Greg Lewin https://www.exploringrpi.com/chapter8/#comment-339 Wed, 07 Mar 2018 14:09:12 +0000 https://www.exploringrpi.com/?page_id=351#comment-339 On Pi3b ttyAMA0 is used by Bluetooth. You can add ‘dtoverlay=pi3-disable-bt’ to /boot/config.txt to disable Bluetooth and restore GPIO use of serial port.
HTH Greg

]]>
By: Aaron Kulkis https://www.exploringrpi.com/chapter8/#comment-337 Sun, 25 Feb 2018 23:04:39 +0000 https://www.exploringrpi.com/?page_id=351#comment-337 http://tinycc/erpi808 is not working.
Is this the correct document (APPLICATION NOTE Bi-directional level shifter for I2C-bus and other systems. AN97055)?

http://datasheet.datasheetarchive.com/originals/distributors/Datasheets-25/DSA-492462.pdf

]]>
By: Niko https://www.exploringrpi.com/chapter8/#comment-331 Fri, 09 Feb 2018 00:10:23 +0000 https://www.exploringrpi.com/?page_id=351#comment-331 If any of you are having problems with i2cdetect not recognizing any circuitry connected to the i2c bus turn off i2c from /boot/config.txt, reboot, and then turn back on. That fixed some problems I was having.

]]>
By: Niko https://www.exploringrpi.com/chapter8/#comment-329 Fri, 09 Feb 2018 00:07:02 +0000 https://www.exploringrpi.com/?page_id=351#comment-329 @Anthony Lucas

6by9 says from the raspberry pi fourm…

“There was a change between iirc the 4.4 and 4.9 kernels to use the upstream bcm2835-i2c driver instead of the older bcm2708-i2c one. Even Jessie had gone to kernel 4.9 though, which would imply that you hadn’t updated the Jessie install for ages. “lsmod” will confirm which driver modules are loaded.”

From what I gathered is that spi_bcm2835 has been replaced with bcm2708. I ran into a similar issue while configuring i2c.

here’s another good link on information about that.

https://raspberrypi.stackexchange.com/questions/840/why-is-the-cpu-sometimes-referred-to-as-bcm2708-sometimes-bcm2835

]]>
By: Nicholas Clark https://www.exploringrpi.com/chapter8/#comment-293 Mon, 06 Nov 2017 20:36:26 +0000 https://www.exploringrpi.com/?page_id=351#comment-293 I’m confused as to why the following changes to listing 8-1 do not give the correct result:

int bcdToDec(int b) {
int result=0;
result += (0x70 & b)*10; // MSB *10
result += (0x0F & b); // LSB

return result;
}

and in the main code change
char buf[BUFFER_SIZE];
to
int buf[BUFFER_SIZE];

Any explanation??

]]>
By: Anthony Lucas https://www.exploringrpi.com/chapter8/#comment-289 Thu, 02 Nov 2017 07:52:50 +0000 https://www.exploringrpi.com/?page_id=351#comment-289 Thank you for a well written, informative book that is a joy to study. I am working through Chapter 8 on a RPi 3 running Linux version 4.9.53-v7+ and have just used raspi-config to update /boot/config.txt to enable SPI. Page 333 says that this will add spi-bcm2708 to modules. however I get:
anthony@mypie:~ $ lsmod | grep spi
spidev 7373 0
spi_bcm2835 7596 0

And I cannot find spi-bcm2708 in /lib/modules/* Is this an error in the book or a change caused by an upgrade to the system??
Anthony

]]>
By: Vikrant https://www.exploringrpi.com/chapter8/#comment-185 Sat, 15 Apr 2017 13:09:29 +0000 https://www.exploringrpi.com/?page_id=351#comment-185 Dear Sir, thanks a lot for the wonderful book on the RPi. i am learning a lot through it. i need some help on SPI port. Till now i have executed the first 4 programs as taught by the book but unfortunately none of them have given the desired output. i checked the SPI port and it works fine independently but not when expanded into a circuit. i ran the same code as i got from GitHub but same result. So i am not sure where I am going wrong. works great with I2C though.
can you please help me get this going right? would love to get this thing of my back as soon as i can to regain confidence.

regards,
Vikrant

]]>
By: Craig Clark https://www.exploringrpi.com/chapter8/#comment-183 Thu, 13 Apr 2017 21:48:51 +0000 https://www.exploringrpi.com/?page_id=351#comment-183 In chapter 8 the wiringPi directory, the DS3231.c program needs to convert from bcd to decimal.

Add your bcdToDec function above int main():
int bcdToDec(int b) { return (b / 16) * 10 + (b % 16); }

Change the main code to:
int secs = bcdToDec(wiringPiI2CReadReg8(fd, 0x00));
int mins = bcdToDec(wiringPiI2CReadReg8(fd, 0x01));
int hours = bcdToDec(wiringPiI2CReadReg8(fd, 0x02));

]]>
By: Clark Sann https://www.exploringrpi.com/chapter8/#comment-177 Mon, 03 Apr 2017 18:11:22 +0000 https://www.exploringrpi.com/?page_id=351#comment-177 I am trying to use WiringPi for I2C on the RPi. More specifically I want to build my RPi app using Eclipse on my Linux VM.

I have read chapter 7 and I’ve watched the video and I am able to cross compile on my Linux VM and deploy and run them on the RPi. The reason I can do this is because your book and your video are superb. I have never found such a easy to understand lesson on a difficult subject like cross compilation. I’ve unsuccessfully struggled with it for years until I found your book and video. THANK YOU!

I am now ready to try to use the WiringPi library to build an app using I2C. I’ve installed and built WiringPi using my Linux VM. I’ve got the paths setup properly in Eclipse. I can build my app. But it won’t link. When I link Eclipse complains my libwiringPi.so file has the wrong file format. I know why this is. It is because I built it using my amd64 toolchain not the armhf toolchain. Can anyone tell me how to build with the armhf toolchain?

I know I can build the library on my RPi and copy it to the Linux VM, but I don’t want to do that. I’d like not have to do development things on the Rpi. I’d prefer to build my library on my Linux machine. Is this possible?

Lastly I’d also like to be able to deploy my app, and all required libraries to a new RPi installation. Is this possible with Eclipse? Will it install my binary as well as needed libraries? If not I might as well get used to having to install WiringPi on every RPi I want to use it on and copy it to the Eclipse machine.

Thanks again for such a great book and video. After I play around with the RPi I plan to purchase a BeagleBone Blue and develop on it. Will you be making a book for the BB Blue?

]]>
By: Alexander Jaworowski https://www.exploringrpi.com/chapter8/#comment-157 Mon, 23 Jan 2017 11:44:25 +0000 https://www.exploringrpi.com/?page_id=351#comment-157 I have also encountered issues with UART setup, but have found solutions.
On rpi and rpi2, there are two things that must be performed (linux 4.4.34+):
1. Disable kernel control of the serial port. Edit /boot/cmdline.txt as described in http://elinux.org/RPi_Serial_Connection. Search for cmdline.txt.

pi@raspberrypi:~/bin $ cat /boot/cmdline.txt
#dwc_otg.lpm_enable=0 console=tty1 console=serial0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

2. Disable serial-getty@ttyAMA0. However it’s not enough to use systemctl disable… as explained in http://stackoverflow.com/questions/21596384/cannot-disable-systemd-serial-getty-service

For rpi3, it seems that renaming of device names is causing problems. ttyAMA0 is used for bluetooth. Serial device is instead attached to ttyS0, see eLinux again, http://elinux.org/RPi_Serial_Connection. Search for cmdline.txt.

]]>