Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with new kernels #4

Open
barcoboy opened this issue Feb 2, 2015 · 9 comments
Open

Not working with new kernels #4

barcoboy opened this issue Feb 2, 2015 · 9 comments

Comments

@barcoboy
Copy link

barcoboy commented Feb 2, 2015

I am trying to debug why I cannot get my PiFace CAD working with new Linux kernels, and I believe I've made some progress.

After running rpi-update, I wasn't able to load the spi-bcm2708 module. I was quite confused about why I couldn't find anything in the Linux source related to that module. I then found the following site which explained it:

http://raspberrypi.stackexchange.com/questions/27073/firmware-3-18-x-breaks-i2c-spi-audio-lirc-1-wire-e-g-dev-i2c-1-no-such-f

So I added the line:

dtparam=spi=on

to my /boot/config.txt file, and that caused the module to appear in the lsmod list, and also the /dev/spidev0.* files re-appeared.

But now, after successfully compiling the pifacecad program, I try to run it with the "open" parameter, and get the following output:

mcp23s17_write_reg: There was a error during the SPI transaction.
mcp23s17_write_reg: There was a error during the SPI transaction.
mcp23s17_write_reg: There was a error during the SPI transaction.
mcp23s17_write_reg: There was a error during the SPI transaction.
mcp23s17_write_reg: There was a error during the SPI transaction.
mcp23s17_write_reg: There was a error during the SPI transaction.
mcp23s17_write_reg: There was a error during the SPI transaction.
mcp23s17_write_reg: There was a error during the SPI transaction.
mcp23s17_read_reg: There was a error during the SPI transaction.
mcp23s17_write_reg: There was a error during the SPI transaction.
mcp23s17_read_reg: There was a error during the SPI transaction.
mcp23s17_write_reg: There was a error during the SPI transaction.
mcp23s17_write_reg: There was a error during the SPI transaction.
mcp23s17_read_reg: There was a error during the SPI transaction.
mcp23s17_write_reg: There was a error during the SPI transaction.
mcp23s17_read_reg: There was a error during the SPI transaction.
mcp23s17_write_reg: There was a error during the SPI transaction.
mcp23s17_write_reg: There was a error during the SPI transaction.
mcp23s17_read_reg: There was a error during the SPI transaction.
mcp23s17_write_reg: There was a error during the SPI transaction.
mcp23s17_read_reg: There was a error during the SPI transaction.
mcp23s17_write_reg: There was a error during the SPI transaction.
mcp23s17_write_reg: There was a error during the SPI transaction.
mcp23s17_read_reg: There was a error during the SPI transaction.
mcp23s17_write_reg: There was a error during the SPI transaction.
mcp23s17_write_reg: There was a error during the SPI transaction.
mcp23s17_read_reg: There was a error during the SPI transaction.
mcp23s17_write_reg: There was a error during the SPI transaction.
mcp23s17_read_reg: There was a error during the SPI transaction.
mcp23s17_write_reg: There was a error during the SPI transaction.
mcp23s17_write_reg: There was a error during the SPI transaction.
mcp23s17_read_reg: There was a error during the SPI transaction.
mcp23s17_write_reg: There was a error during the SPI transaction.

@barcoboy
Copy link
Author

barcoboy commented Feb 3, 2015

Interestingly enough, after upgrading to OpenELEC 5 from OpenELEC 4, my PiFaceCAD stopped working, and I am getting a very similar error message when running LCDd:

HD44780: PiFaceCAD: mcp23s17_write_reg: There was a error during the SPI transaction: Invalid argument

@barcoboy
Copy link
Author

Just found about Issue #791 in raspberrypi/linux, and adding device_tree=off fixes the problem I was having running the PiFaceCAD sysinfo.py demo. I then updated libmcp23s17, and now pifacecad is working again! :-)

@barcoboy
Copy link
Author

I've also found the reason that lcdproc stopped working in OpenELEC... explained on this page:

http://www.raspberrypi.org/forums/viewtopic.php?f=29&t=97216&start=50

Confirmed that patching server/drivers/hd44780-pifacecad.c by adding a couple of "memset (&spi, 0, sizeof(spi));" lines and recompiling lcdproc gets my PiFaceCAD working again in OpenELEC.

@tompreston
Copy link
Member

Just to confirm, this is the issue which has being fixed?

https://github.com/piface/libmcp23s17/issues/8

@barcoboy
Copy link
Author

barcoboy commented Mar 9, 2015

Yes. It also fixed the same issue in LCDProc when I patched it.

@DietShasta
Copy link

Hi barcoboy,

How and what did you patch exactly? I'm getting the same errors with my pifacecad through lcdproc.

I'm not sure where libmcp23s17 is located and how to apply the patch that was posted on the link.

Thank you!

@barcoboy
Copy link
Author

barcoboy commented Apr 5, 2015

Hi DietShasta.

libmcp23s17 is "A simple C library for accessing an MCP23S17 port expander." You can download it using git from the site below:

https://github.com/piface/libmcp23s17

The patch that I was referring to has already been merged into the latest version, so you should not need to do anything if you wish to use it (with libpifacecad for example, found at https://github.com/piface/libpifacecad)

As for lcdproc, you will want to download the latest CVS version of it, at this link:

http://lcdproc.cvs.sourceforge.net/viewvc/lcdproc/lcdproc/

Find the "Download GNU tarball" at the bottom of the page. Once you have downloaded the file and extracted it, the file you will want to patch is found at ./server/drivers/hd44780-pifacecad.c

Insert the following at line 128:

memset (&spi, 0, sizeof(spi));

so that:

struct spi_ioc_transfer spi;
spi.tx_buf = (unsigned long) tx_buf;
spi.rx_buf = (unsigned long) rx_buf;

becomes this:

struct spi_ioc_transfer spi;
memset (&spi, 0, sizeof(spi));
spi.tx_buf = (unsigned long) tx_buf;
spi.rx_buf = (unsigned long) rx_buf;

Repeat adding the same line at line 159 (or 160 once you've added the line above).

Now recompile lcdproc, and the error messages will disappear and your display should start working again.

@DietShasta
Copy link

Thank you so much for your detailed explanation. Making the change to hd44780-pifacecad.c brought my pifacecad back to life!

@e6on
Copy link

e6on commented Apr 19, 2015

Hi guys

Can you guys explain to Linux newbie, who just installed LCDproc 0.5.7 from packet of Debian test sources to rasbian and gets the same error, how to fix this?

I downgraded firmware-kernel to 3.12.36 for now to get it to work, but still want to know how to get it to work on 3.18.x firmware-kernel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants