Tiny Core Linux
Tiny Core Base => Raspberry Pi => Topic started by: boudinec on January 09, 2025, 11:09:03 AM
-
Hello
I want to use pwm and spi on a raspberry 3 using piCore 15.0.
In /mnt/mmcblkp1, I added:
dtparam=spi=on
dtparam=pwm=on
Then I rebooted.
The SPI works, I can use /dev/spidev0.0
But I cannot manage to make the PWM module working: the directory /sys/class/pwm/ is still empty.
Can you help me to fix this ?
Bests
Cedric
-
GPIO is all changed in the newer raspi kernels. I'm not sure dtparam=pwm is even an option anymore. Make sure you are looking at documentation from kernel 6.6.y
You need to look at the dtoverlays for pwm
https://github.com/raspberrypi/linux/blob/14c5fee3bb3fd654605c33314645b27a8f1e7628/arch/arm/boot/dts/overlays/README#L4024
-
Hello
Thanks for you answer Paul
I forgot to tell that my RPi is a 3B.
I also tried:
dtoverlay=pwm,pin=12,func=4
and
dtoverlay=pwm,pin=18,func=2
Which is what is explained in the docs. But it doesn't works.
The documentation is the same as with bookworm (kernel 6.6.62) and the same config works.
I cannot see any errors in dmesg. Do you know if some errors messages are available about overlays?
I also tried to load from the shell but the overlays cannot be found:
tc@box:~$ dtoverlay -a
*Failed to find overlays directory
Do you know what show be the overlays directory?
Bests
-
The overlays directory is at /mnt/mmcblk0p1/overlays - you need to mount /dev/mmcblk0p1 first.
-
I mounted /dev/mmcblk0p1 with the graphical tool, so it is mounted as /mnt/mmcblk0p1.
And sitll dtoverlay fails to locate the overlays.
On raspberryPIOS, overlays are searched in /boot/overlays.
So, I created a simlink :
sudo ln -s /mnt/mmcblk0p1 /boot
The error has changed:
$sudo overlay -l
mount: /config/device-tree: mount point does not exist.
dmesg(1) may have more information after failed mount system call
* Failed to mount configfs - 2
dmesg gives no information about mount errors
Cedric
-
Tinycore does not use a configfs. If you want to use dtoverlay to add an overlay, you need to specify everything.
I would just setup your config.txt and look at dmesg. The first thing to look at is if the driver is even there. The base system only includes the bare minimum. I think you need pwm-bcm2835 which is not in the base. You would need to get the module from here for your board
http://www.tinycorelinux.net/15.x/armhf/releases/RPi/src/kernel/modules-6.6.47-piCore.tar.xz
Make sure you the module pack matches the kernel version you are running.
-
Hello Paul
Thanks a lot Paul.
I just extracted pwm-bcm2835.ko from modules-6.6.47-piCore-v7.tar.xz and ran:
sudo insmod pwm-bcm2835.ko
I can now use the pwm module.
Do you think that the ko file can be included in the base for next release? It is a builtin peripheral on raspberry PI like spi and i2c.
Bests
Cedric
-
It’s not commonly used, but it’s always available. You can easily make an extension for it.
-
Ok thanks
Bests
-
Hi boudinec
... You can easily make an extension for it.
Here is an example of how to make an extension:
https://forum.tinycorelinux.net/index.php/topic,26064.msg167212.html#msg167212