WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: How to enable SPI interface?  (Read 303 times)

Offline seedsigner

  • Newbie
  • *
  • Posts: 10
How to enable SPI interface?
« on: April 05, 2021, 12:41:39 PM »
I am running PiCore 13.0.3 on a Raspberry Pi Zero W. I've gotten the WiFi working and can download extensions just fine (yay!).

I am attempting to execute a compiled Python program that utilizes the SPI interface to utilize a GPIO connected screen/controls, and I don't think the SPI is enabled by default. The errors thrown by the program seem to reference the SPI interface.

Can anyone provide guidance on whether SPI is enabled by default, or how I can do so?

Thank you!

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 9025
Re: How to enable SPI interface?
« Reply #1 on: April 05, 2021, 01:45:02 PM »
Hi seedsigner
I think there's a  config.txt  file for this. First you need to mount the boot partition:
Code: [Select]
sudo mount /dev/mmcblk0p1 /mnt/mmcblk0p1
Then take a look in  /mnt/mmcblk0p1/config.txt.

This thread deals with  i2c  but might point you in the right direction:
http://forum.tinycorelinux.net/index.php/topic,20139.msg125313.html#msg125313

Offline seedsigner

  • Newbie
  • *
  • Posts: 10
Re: How to enable SPI interface?
« Reply #2 on: April 05, 2021, 03:25:09 PM »
Appreciate the link. I checked initially and there was no config.txt in that location yet, will read that other thread. Thank you.

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 9025
Re: How to enable SPI interface?
« Reply #3 on: April 05, 2021, 05:25:06 PM »
Hi seedsigner
... I checked initially and there was no config.txt in that location yet, ...
Did you run the mount command I showed you in reply #1? That partition is automatically unmounted after the Pi boots.

Offline seedsigner

  • Newbie
  • *
  • Posts: 10
Re: How to enable SPI interface?
« Reply #4 on: April 06, 2021, 07:41:53 AM »
Oh gosh, that was some nuance that I missed, my mistake. Found it and found the option I was looking for.

Only hitch is that now my OS boots to a GUI, wanted to keep it as a command line interface for fast startup and use SPI for a peripheral GPIO device. Going to do some more reading...

Thanks again.

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 9025
Re: How to enable SPI interface?
« Reply #5 on: April 06, 2021, 07:51:20 AM »
Hi seedsigner
You probably have  TC.tcz  listed in your  tce/onboot.lst  file. Remove that entry from the file and reboot.

Offline seedsigner

  • Newbie
  • *
  • Posts: 10
Re: How to enable SPI interface?
« Reply #6 on: April 06, 2021, 12:23:35 PM »
Right again, really appreciate your help with this.

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 9025
Re: How to enable SPI interface?
« Reply #7 on: April 06, 2021, 12:29:19 PM »
Hi seedsigner
Thanks for confirming it worked.

Offline seedsigner

  • Newbie
  • *
  • Posts: 10
Re: How to enable SPI interface?
« Reply #8 on: April 06, 2021, 07:17:15 PM »
A little off the original topic, but I'm trying to experiment with boot codes to eliminate anything unnecessary. I've added "print.time=1" to the cmdline.txt to try and get some info about the boot -- with this enabled, where am I able to see the logged times?

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 9025
Re: How to enable SPI interface?
« Reply #9 on: April 06, 2021, 07:33:23 PM »
Hi seedsigner
You can do this:
Code: [Select]
dmesg | lessUse  PageUp/PageDown  to navigatre,  q  to quit.

Or you can redirect the output to a file:
Code: [Select]
dmesg > dmesg.txtNow you can view  dmesg.txt  using an editor, web browser, or whatever program you choose.