Skip to content

Problem with nanoFramework.Hardware.Esp32.Rmt #1686

@NazzaN

Description

@NazzaN

Library/API/IoT binding

nanoFramework.Hardware.Esp32.Rmt

Visual Studio version

VS2022

.NET nanoFramework extension version

2022.14.1.2

Target name(s)

ESP32_S3_BLE, XIAO_ESP32C3, ESP32_C3_REV3, ESP32_C6_THREAD

Firmware version

1.14.0.59

Device capabilities

No response

Description

Hi, I found a probably issue on nanoFramework.Hardware.Esp32.Rmt v2.0.35

with this code:

                var rxChannelSettings = new ReceiverChannelSettings(3)
                {
                    // 1us clock ( 80Mhz / 80 ) = 1Mhz
                    //ClockDivider = 80,
                    // no filter
                    EnableFilter = true,
                    FilterThreshold = 100,
                    // max time 1us clock
                    //IdleThreshold = ushort.MaxValue,
                    IdleThreshold = 40_000,
                    // timeout after 1 second
                    ReceiveTimeout = TimeSpan.FromSeconds(1),
                    EnableDemodulation = false
                };
               using var rxChannel = new ReceiverChannel(rxChannelSettings);

I receive:

++++ Exception System.Exception - CLR_E_DRIVER_NOT_REGISTERED (3) ++++
++++ Message: 
++++ nanoFramework.Hardware.Esp32.Rmt.ReceiverChannel::NativeRxInit [IP: 0000] ++++
++++ nanoFramework.Hardware.Esp32.Rmt.ReceiverChannel::.ctor [IP: 001a] ++++

on ESP32_S3_BLE XIAO_ESP32C3 ESP32_C3_REV3 ESP32_C6_THREAD

workaround is to manualy set the channel

   var rxChannelSettings = new ReceiverChannelSettings(3)
                {
                    EnableFilter = true,
                    FilterThreshold = 100,
                    IdleThreshold = 40_000,
                    ReceiveTimeout = TimeSpan.FromSeconds(1),
                    //Inserting this work but non on all boards
                    **Channel = 4,**
                    EnableDemodulation = false
                };
               using var rxChannel = new ReceiverChannel(rxChannelSettings);

but this work only on ESP32_S3_BLE non on C3 and not on C6

this problem affect also other classes using Esp32 Rtm:
Iot.Device.DHTxx.Esp32.DhtBase constructor (workaround ok only on S3)

[nanoFramework.IoT.Device/DhtBase.csdevices/Dhtxx.Esp32/DhtBase.cs]https://github.com/nanoframework/nanoFramework.IoT.Device/blob/develop/devices/Dhtxx.Esp32/DhtBase.cs

NeoPixel.NeopixelChain (affected only C3 and C6) this sample is using TransmitterChannel
samples/Hardware.Esp32.Rmt/NeoPixelStrip/NeoPixel/NeopixelChain.cs
https://github.com/nanoframework/Samples/blob/main/samples/Hardware.Esp32.Rmt/NeoPixelStrip/NeoPixel/NeopixelChain.cs

I find the exception on C++ code but I've not IDE and skills to investigate:
....nanoFramework.Hardware.Esp32.Rmt/nanoFramework_hardware_esp32_rmt_native_nanoFramework_Hardware_Esp32_Rmt_ReceiverChannel.cpp::NativeRxInit___I4
....nanoFramework.Hardware.Esp32.Rmt/nanoFramework_hardware_esp32_rmt_native_nanoFramework_Hardware_Esp32_Rmt_TransmitterChannel.cpp::NativeTxInit___I4

Thanks for attention.

N.

How to reproduce

Try to use Dht22 with Dhtxx.Esp32 or initialize ReceiverChannelSettings without an explicit channel in settings.
For XIAO_ESP32C3, ESP32_C3_REV3, ESP32_C6_THREAD:
Try to initialize ReceiverChannelSettings with or without an explicit channel in settings.

Expected behaviour

No response

Screenshots

No response

Sample project or code

  var rxChannelSettings = new ReceiverChannelSettings(3)
                {
                    // 1us clock ( 80Mhz / 80 ) = 1Mhz
                    //ClockDivider = 80,
                    // no filter
                    EnableFilter = true,
                    FilterThreshold = 100,
                    // max time 1us clock
                    //IdleThreshold = ushort.MaxValue,
                    IdleThreshold = 40_000,
                    // timeout after 1 second
                    ReceiveTimeout = TimeSpan.FromSeconds(1),
                    EnableDemodulation = false
                };
               using var rxChannel = new ReceiverChannel(rxChannelSettings);

Aditional information

XIAO_ESP32C3, ESP32_C3_REV3, ESP32_C6_THREAD has problem with TransmitterChannel and ReceiverChannel

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions