Initiate PWM on a Raspberry Pi runs in a SEHExcept

2019-06-01 02:46发布

I am currently realizing a project in C # on a Raspberry Pi 3. On the Pi, Windows runs IoT Core in the latest stable release release (v.10.0.16299.309). When I initiate the PWM pins, the method runs in an exception (System.Runtime.InteropServices.SEHException: 'External component raised an exception.'). All rights are set and all releases are set on the Windows Fall Creators Update. Can someone be with me. Thank you.

here the Code:

private async void StartPWM()
    {
        GpioController gpioController = await GpioController.GetDefaultAsync();
        if (LightningProvider.IsLightningEnabled)
        {
            try
            {
                LowLevelDevicesController.DefaultProvider = LightningProvider.GetAggregateProvider();
                var pwmControllers = await PwmController.GetControllersAsync(LightningPwmProvider.GetPwmProvider());
                var pwmController = pwmControllers[1];
                pwmController.SetDesiredFrequency(50); //<---- Here it crasches

                dictionaryPwm = new Dictionary<int, PwmPin>
                {
                    {23,PWM.ActivatePwmPin(23,pwmController) },
                    {24,PWM.ActivatePwmPin(24,pwmController) }
                };
            }
            catch(Exception exception)
            {
                throw exception;
            }
        }
    }

1条回答
倾城 Initia
2楼-- · 2019-06-01 03:37

I ran into this same issue. In your project properties, try setting up your Targeting as follows:

Targeting setup

查看更多
登录 后发表回答