Serial Debug Help

so looks my schematic and my board

The problem is that modules are not recognized.

I see in device manager and does nothing when I plug and unplug it

Are you sure the dev is in Bootloader mode?

how can I check this ?

You will see COMx(GHI Electronics) in TinyCLR Config, or new COM port shown under Device Manager. If not then the device is not in Bootloader.

How did you enter GHI Bootloader?

I press the button LDR on Low but when I do this it does nothing
are there other ways to get into the bootloader without using buuton ?

Then did you hit reset button and still keep the LDR low?
And, what status of MOD pin during this time? I see this is custom board so make sure those pins are is correct state.

I am sure that if I press the three buttons LDR,MODE and Reset I will get a 0V on the 3 pin.

That is a problem. The MOD pin is 0V mean serial debug, not usb.

Or you need serial cable and connect to UART5 tx, rx
Or, set MOD pin high then you can use usb cable through usb port.

Thank you I do that

I suggest you try all this on the dev board to get a good understanding of how it all works and test your setup.

which pins do you recommend for Serial Debugger except pin 29 and 30 for model SCM20260N

There are dedicated pins for that and can’t be changed. SITCore System on Chip under debug interface.

Hi all can anyone tell me why this error comes after

var usbclientController = UsbClientController.GetDefault();

can you confirm you have successfully switched deploying and debugging to serial mode using MOD pin?
you can confirm it is possible to deploy and debug by using serial port?

Because after that the USB is not available for debugging anymore. And your probably trying to use it.
Initialize USB client only if debug interface != USB

 if (DeviceInformation.DebugInterface == DebugInterface.Serial)
     // put that code here

we keep going in circles around the same issue. You MUST use serial debugging to free up USB so you can use in your application.

Hello together can you use the Librayfor USBHost and USBClient in the same program ?
because when I used it, the program gives an error that the keyboard is present in the two libraries.

We have not tested that so I am not sure personally. We can look into it. Can you tell us what is the commercial need for this or you are simply testing things out?

In my application I develop a product with the module SCM2026N. my circuit contains two USB host and client. In the USB host a keyboard is connected and when a key is printed the keys are transferred to the laptop.
I don’t know yet if this works because when I write in program USB host and Client. the program is complaining Keyboard . it doesn’t recognize if Keyboard belongs to Client or to Host.

Are you talking about error that you couldn’t compile? If so then yes, of course. Keyboard is in both USB Client and host, so if you are using both nugets in same application, easy way is give them full name (include namespace).

At run time, we have tried run USB Host and USB Client at the same time. USBClient for CDC, USB host for keyboard. It runs fine. Tested at v2.1.0-rc2 but rc1 or some latest previews should be OK.

The code below are what we tested:

class Program {
        const int LED1 = SC20260.GpioPin.PB0; // PB0
        const int LDR1 = SC20260.GpioPin.PB7; // PB7;

        static GpioPin led1;
        static GpioPin ldr1;

        static void Main() {
            var controller = GpioController.GetDefault();

            led1 = controller.OpenPin(LED1);
            ldr1 = controller.OpenPin(LDR1);



            int cnt = 0;
            while (ldr1.Read() == GpioPinValue.High) {

                led1.Write(led1.Read() == GpioPinValue.Low ? GpioPinValue.High : GpioPinValue.Low);



                if (cnt % 10 == 0) {

                    Debug.WriteLine("Memory free: " + Memory.ManagedMemory.FreeBytes / 1024);


            new Thread(DoTestUsbHost).Start();



        static int totalRead = 0;
        static void DoTestCdc() {

            var usbclientController = UsbClientController.GetDefault();

            var usbClientSetting = new UsbClientSetting()
                Mode = UsbClientMode.Cdc,
                ManufactureName = "Manufacture_Name",
                ProductName = "Product_Name",
                SerialNumber = "12345678",

            var cdc = new Cdc(usbclientController, usbClientSetting);

            cdc.DeviceStateChanged += (a, b) => Debug.WriteLine("Connection changed.");
            cdc.DataReceived += (a, count) => Debug.WriteLine("Data received:" + count);


            while (cdc.DeviceState != DeviceState.Configured) ;
            Debug.WriteLine("UsbClient Connected");

            // The example will read data from port to dataR array
            // Copy dataR to dataW array, plus 1 for each element
            // Write dataW array back to port

            while (true) {
                var len = cdc.Stream.BytesToRead;

                if (len > 0) {
                    var dataR = new byte[len];
                    var dataW = new byte[len];
                    int read = cdc.Stream.Read(dataR);

                    for (var i = 0; i < read; i++) {
                        dataW[i] = (byte)(dataR[i] + 1);

                    totalRead += read;

                    Debug.WriteLine("Total read: " + totalRead);

        static void DoTestUsbHost() {

            var controller = UsbHostController.GetDefault();

            controller.OnConnectionChangedEvent += Controller_OnConnectionChangedEvent;



        private static void Controller_OnConnectionChangedEvent(UsbHostController sender, DeviceConnectionEventArgs e) {
            switch (e.DeviceStatus) {
                case DeviceConnectionStatus.Connected:
                    switch (e.Type) {
                        case BaseDevice.DeviceType.Keyboard:
                            var keyboard = new GHIElectronics.TinyCLR.Devices.UsbHost.Keyboard(e.Id, e.InterfaceIndex);
                            keyboard.KeyUp += Keyboard_KeyUp;
                            keyboard.KeyDown += Keyboard_KeyDown;


        private static void Keyboard_KeyDown(GHIElectronics.TinyCLR.Devices.UsbHost.Keyboard sender, GHIElectronics.TinyCLR.Devices.UsbHost.Keyboard.KeyboardEventArgs args) {
            Debug.WriteLine("Key pressed: " + ((object)args.Which).ToString());
            Debug.WriteLine("Key pressed ASCII: " +
        private static void Keyboard_KeyUp(GHIElectronics.TinyCLR.Devices.UsbHost.Keyboard sender, GHIElectronics.TinyCLR.Devices.UsbHost.Keyboard.KeyboardEventArgs args) {
            Debug.WriteLine("Key released: " + ((object)args.Which).ToString());
            Debug.WriteLine("Key released ASCII: " + ((object)args.ASCII).ToString());

Of course you can not use our builtin USBClient keyboard when CDC active, it requires you implement USB Client raw, but USB Host keyboard is separated thing it totally OK as example above.