Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: seedsigner on April 05, 2021, 03:41:39 PM

Title: How to enable SPI interface?
Post by: seedsigner on April 05, 2021, 03: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!
Title: Re: How to enable SPI interface?
Post by: Rich on April 05, 2021, 04: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
Title: Re: How to enable SPI interface?
Post by: seedsigner on April 05, 2021, 06: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.
Title: Re: How to enable SPI interface?
Post by: Rich on April 05, 2021, 08: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.
Title: Re: How to enable SPI interface?
Post by: seedsigner on April 06, 2021, 10: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.
Title: Re: How to enable SPI interface?
Post by: Rich on April 06, 2021, 10: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.
Title: Re: How to enable SPI interface?
Post by: seedsigner on April 06, 2021, 03:23:35 PM
Right again, really appreciate your help with this.
Title: Re: How to enable SPI interface?
Post by: Rich on April 06, 2021, 03:29:19 PM
Hi seedsigner
Thanks for confirming it worked.
Title: Re: How to enable SPI interface?
Post by: seedsigner on April 06, 2021, 10: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?
Title: Re: How to enable SPI interface?
Post by: Rich on April 06, 2021, 10: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.