WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: PWM on piCore  (Read 151 times)

Offline boudinec

  • Newbie
  • *
  • Posts: 18
PWM on piCore
« 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

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1291
Re: PWM on piCore
« Reply #1 on: January 09, 2025, 12:22:55 PM »
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

Offline boudinec

  • Newbie
  • *
  • Posts: 18
Re: PWM on piCore
« Reply #2 on: January 10, 2025, 05:51:14 AM »
Hello
Thanks for you answer Paul

I forgot to tell that my RPi is a 3B.
I also tried:
Code: [Select]
dtoverlay=pwm,pin=12,func=4and
Code: [Select]
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:
Code: [Select]
tc@box:~$ dtoverlay -a
*Failed to find overlays directory

Do you know what show be the overlays directory?

Bests

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14867
Re: PWM on piCore
« Reply #3 on: January 10, 2025, 06:03:54 AM »
The overlays directory is at /mnt/mmcblk0p1/overlays - you need to mount /dev/mmcblk0p1 first.

Offline boudinec

  • Newbie
  • *
  • Posts: 18
Re: PWM on piCore
« Reply #4 on: January 10, 2025, 07:21:32 AM »
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 :
Code: [Select]
sudo ln -s /mnt/mmcblk0p1 /boot
The error has changed:
Code: [Select]
$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

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1291
Re: PWM on piCore
« Reply #5 on: January 10, 2025, 10:31:00 AM »
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.