question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RPI4 PWM can't be used with Windows11

See original GitHub issue

Describe the bug When I execute the Sample code, I get an error message like the following.

Unhandled exception. System.ArgumentException: No PWM device exists for PWM chip at index 0. (Parameter ‘chip’) at System.Device.Pwm.Channels.Windows10PwmChannel…ctor(Int32 chip, Int32 channel, Int32 frequency, Double dutyCycle) at System.Device.Pwm.PwmChannel.CreateWindows10PwmChannel(Int32 chip, Int32 channel, Int32 frequency, Double dutyCyclePercentage) at System.Device.Pwm.PwmChannel.Create(Int32 chip, Int32 channel, Int32 frequency, Double dutyCyclePercentage) at GPIOTry.Program.Main(String[] args) in D:\Chester\Project\RPI4\Windows\GPIOTry\GPIOTry\Program.cs:line 16

I changed the boot/config.txt according to “https://github.com/dotnet/iot/blob/main/Documentation/raspi-pwm.md”, But the same problem still occurs.

// put sample code here
using System;
using System.Device.Gpio;
using System.Device.I2c;
using System.Device.Spi;
using System.Device.Pwm;
using System.Threading;
namespace GPIOTry
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            var gpiocontroller = new GpioController();
            
            PwmChannel pwmcontroller = PwmChannel.Create(0,0,400,0);
            pwmcontroller.Start();
            gpiocontroller.OpenPin(2, PinMode.Output);
            byte bringth = 0;
            try
            {
                while (true)
                {
                    bringth++;
                    if (bringth == 11)
                        bringth = 0;
                    pwmcontroller.DutyCycle=bringth*0.1;
                    gpiocontroller.Write(2, PinValue.High);
                    Console.WriteLine("Duty is " + bringth.ToString());
                    Console.WriteLine("Set GPIO2 High");
                    Thread.Sleep(1000);
                    gpiocontroller.Write(2, PinValue.Low);
                    Console.WriteLine("Set GPIO2 Low");
                    Thread.Sleep(1000);
                }
            }
            finally
            {
                pwmcontroller.Stop();
                gpiocontroller.ClosePin(2);
            }
        }
    }
}

Platform: RPI4B
OS: Windows11
System.Device.Gpio: 1.5.0

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
pgrawehrcommented, Aug 21, 2021

I think there’s nothing we can do here, until the low-level drivers are in place.

1reaction
pgrawehrcommented, Oct 26, 2021

@raffaeler Pretty complex task to get that installed, but since Windows 11 will (very likely) be officially available for ARM64 (see here: https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewARM64) we should start investigating this setup. Not sure if I find time to do this, but it does sound interesting.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Finally Install Windows 11 On The Raspberry Pi 4 ... - YouTube
We can now Install Windows 11 or Windows 10 on the Raspberry Pi 4 without using a PC! We can do it all...
Read more >
FAQ | Windows on R
Frequently Asked Questions. Windows on Raspberry imager. Why does the installation process keep failing? Please check that: you're using the latest version ......
Read more >
What is the point for a consumer to use a Raspberry PI 4 ...
The Pi 4 uses a BCM2711, which according to Passmark, is about 4X slower than an Intel N5105. I do think the PI...
Read more >
windows 11 safe to use? - Raspberry Pi Forums
Hiyo I recently have been messing with windows 11 on a pi4. How safe is it compared to using pi os or ubuntu?...
Read more >
CEO: Raspberry Pi inventory to hit 1M units monthly ...
Mine used only 2W at idle in Windows 11, and the CPU is limited to 10W TDP so heat and noise don't get...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found