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

Unable to get BusPirate to show up as i2c bus #1

Open
ggiraudon opened this issue Jun 21, 2019 · 5 comments
Open

Unable to get BusPirate to show up as i2c bus #1

ggiraudon opened this issue Jun 21, 2019 · 5 comments

Comments

@ggiraudon
Copy link

ggiraudon commented Jun 21, 2019

Hi Tony,

If built your module as per your instructions except for 2 small variations ;

  • in include/linux/tty.h 25 was already used (kernel 4.9.0.9) so I used 26 instead
  • in sys-utils/ldattach.c I also used 26

Everything compiles normally and I am able to load the module without any issues.
I can confirm that the buspirate is connected properly and working. I can manually set it to i2c mode via picocom and run a scan for addresses successfully.

If I run "ldattach BUSPIRATE /dev/ttyUSB0" everything seems to work correctly.
Howevever, if i then run "i2cdetect -l" , I get no output.

If I run "ldattach -d BUSPIRATE /dev/ttyUSB0" I get the following :

root@slam:~# ldattach -d BUSPIRATE /dev/ttyUSB0
ldattach: opened /dev/ttyUSB0
ldattach: set to raw 0 ---: cflag=0xb0
ldattach: line discipline set to 26

which seems correct.
But I still get no output out of "i2cdetect -l"

I was wondering : do I have to recompile my kernel with the changes to include/linux/tty.h (I dont think so... but I just want to make sure).
If that isnt the case, would you have any pointers as to what I might be doing wrong ? Is there anything I can do to troubleshoot this further ?

Thanks in advance

MadBeggar

@tonyhutter
Copy link
Owner

Hmm, everything looks ok. You shouldn't need to recompile the kernel. Did you try running sudo i2cdetect -l?

@ggiraudon
Copy link
Author

I'm actually running all commands as root so that wouldnt be the issue.
I'm going to try adding a few more printk() in the module code to see what gets called...

@ggiraudon
Copy link
Author

I figured out one part of my puzzle : the module "i2c_dev" wasnt loaded.
I can now see my device and scan successfully.
However, when I tried to make a read, I get timeouts on the code side.
On the kernel side, here's what I have :

[21340.101273] buspirate: module loaded
[21585.301256] i2c i2c-1: Got 1 bytes spurious data
[21585.459275] i2c i2c-1: Got 1 bytes spurious data
[21585.732359] i2c i2c-1: Got 1 bytes spurious data
[21585.762390] i2c i2c-1: Got 1 bytes spurious data
[21585.810245] i2c i2c-1: Got 1 bytes spurious data
[21585.842121] i2c i2c-1: Got 1 bytes spurious data
[21586.336709] i2c i2c-1: Got 1 bytes spurious data
[21616.079662] i2c i2c-1: Got 1 bytes spurious data
[21616.364853] i2c i2c-1: Got 1 bytes spurious data
[21616.494197] i2c i2c-1: Got 1 bytes spurious data
[21617.387647] i2c i2c-1: Got 1 bytes spurious data
[21622.333853] i2c i2c-1: Got 1 bytes spurious data
[21632.416124] i2c i2c-1: Got 1 bytes spurious data
[21633.247491] i2c i2c-1: Got 1 bytes spurious data
[21633.325451] i2c i2c-1: Got 1 bytes spurious data
[21633.453085] i2c i2c-1: Got 1 bytes spurious data
[21633.503053] i2c i2c-1: Got 1 bytes spurious data
[21723.921792] i2c i2c-1: Got 1 bytes spurious data
[21724.001752] i2c i2c-1: Got 1 bytes spurious data
[21724.112934] i2c i2c-1: Got 1 bytes spurious data
[21724.496242] i2c i2c-1: Got 1 bytes spurious data
[21724.672892] i2c i2c-1: Got 1 bytes spurious data

Any ideas ?

@ggiraudon
Copy link
Author

Is there a way to see the output of dev_dbg( ) ?

@tonyhutter
Copy link
Owner

You could try setting /proc/sys/kernel/printk
https://elinux.org/Debugging_by_printing#Log_Levels

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

2 participants