Main Site Documentation

TinyCLR OS and STM32F4 Discovery - how to get the bootloader into Virtual COM mode?


#1

Hi,

I’m working with an STM32F401 Discovery board.

The first time I loaded the TinyCLR OS firmware everything went fine. I loaded the GHI Bootloader, reset the board, and it went into Virtual COM mode. I then uploaded the firmware through TeraTerm, and that worked great.

I decided to try rebuilding the firmware (without making any changes to it). The build worked fine.

However, I can’t figure out how to get the board to go into Virtual COM mode again. The Bootloader documentation page says this is usually controlled by a MODE pin. I noticed that the DeviceSelector.h for the FEZ board lists the MODE pin as B10, but connecting it to VDD, 5V or GND had no apparent effect - the bootloader loads the existing firmware.

I guessing that erasing the existing firmware would do the trick, but I don’t know how to do that.

Help?

Thanks,

Dan.


#2

Try holding the LDR0 low on reboot


#3

Hi,

I’m not sure which pin that would be on the STM32F4 Discovery. The DeviceSelector.h file says that C13 is the Loader pin, so I tried connecting that to GND. It had some effect, in that my application didn’t run. However, the FEZ firmware still ran, and there was no Virtual COM port. Back in the day, we used to use MFDeploy at this point, but I’m assuming that no longer applies.

That reminded me, though, that we used to use STDFUTester to upload the bootloader, as documented here: https://www.ghielectronics.com/docs/46/fez-cerb-family-developers-guide#3253. Unlike DfuSeDemo, that tool has an erase option, so I used that to wipe the flash, then load the bootloader. When I took that approach, resetting the board brought it into Virtual COM mode, and I was able to upload the new firmware.

Thanks for your help,

Dan.


#4

You can do this the easy way, connect dfu, erase everything, load the loader… Do you see the virtual port?


#5

Could i use this firmware as is for STM32F411RET6 (Nucleo or need to modify any files)

regards,
VALONI


#6

@ valon.hoti@ gmail.com - yes but I think you need to wire a USB connector.


#7

@ valon.hoti@ gmail.com - I was able to get TinyCLR working with that same Nucleo board. I didn’t do much more than a blinky project to test it, but that much works fine.

As Gus says, you need to add a second USB port. I used a breakout board like this one: https://www.adafruit.com/product/1764

In addition to connecting 5V and GND to the Nucleo, connect the USB port’s D+ to PA12 and D- to PA11. I left the ID pin unconnected.

The only trick is that you need to make sure that the STM32F4 is using an external crystal. If you have a recent Nucleo board then it uses the 8Mhz crystal at the top of the board by default, so you don’t need to change anything. Older boards (I don’t have one, but apparently the sticker on the back contains “-C1”) require that you put solder on 2 solder bridges, SB16 and SB50.

Power the board (I connected the top USB port to a USB power source) and connect the 2nd USB port to your PC.

I used the FEZ bootloader and firmware, and it worked without any problems.

Regards,

Dan.


#8

@ Dan1 - How you upload onto Nucleo Bootloader and Firmware

can explain procedures

using DFU DEMOS i used to upload FEZ Bootloader.2.0.3.dfu
and i show now GHI Bootloader Interface (com 5)

but how to upload TinyCLR 050 HEX !!!

thanx a lot


#9

@ valon.hoti@ gmail.com - using 1k xmodem. I use teraterm. See the bootloader document http://docs.ghielectronics.com/hardware/bootloader.html


#10

@ Gus_ghielectroncs i still can not understand way how to upload firmware

please can you explain way “and command” step by step how to upload firmware via TeraTerm

I connected via tera term on Serial COM5 it showed me :

GHI Electronics , LLC Bootloader

OK

but how to send ???
and which firmeware (gbl / hex / dfu)

and sorry for asking by my side since i never used this way of uploading firmware
"because i just used by default ST-LINK for bootloader and then deployed with MFDeploy for HEX"

also tried this way *but it stuck at 0.5% and nothing happen
https://www.ghielectronics.com/docs/53/firmware-update-usbizi


#11

How i get zero to blinking blue led …

you need
STLink (from st http://www.st.com/en/embedded-software/stsw-link004.html)
Dfu programs (from st http://www.st.com/en/development-tools/stsw-stm32080.html)
Tera term (https://ttssh2.osdn.jp/index.html.en)
Follow the guide in http://docs.ghielectronics.com/tinyclr/intro.html for software installation
Follow the guide in http://docs.ghielectronics.com/tinyclr/tutorials/intro.html

-First using Dfu file manager convert FEZ Bootloader.2.0.3.dfu to hex format
-Connect the discovery board with mini usb to computer.
-using st link install hex bootloader to board (Click connect->open load hex->Verify program->start)
-Look at device manager for com ports note the existing ones (when we connect the board there will be a new one)
-Connect mini usb cable to power adapter, micro usb to computer
-Computer should detect device if not you need drivers ( https://www.ghielectronics.com/community/forum/topic?id=24584 )
-Look at devce manager com ports. The new one is our board
-Connect to new com port via tera term with the setting (115200,8,n,1)
-You should see a firendly banner from ghi (“GHI Electronics, LLC Bootloader”)
-Press U enter and When it asks “Are you sure (Y/N)?” Press Y enter
-When you see CCCCCCCC… click (File->Transfer ->XModem->Send)
-On file selection click 1k checkbox on the bottom and select “FEZ Firmware.0.5.0.glb”
-It takes about 10 seconds to upload
-When the upload finishes press R enter when you see "“Are you sure (Y/N)?” press Y enter
-Now device should be ready for programming.

-Open Visual Studio 2017
-Click New project->Tiny clr->Tiny clr application
Delete program.cs content and Copy paste the following code:

 
// -----copy start
using System;
using System.Threading;
using GHIElectronics.TinyCLR.Devices.Gpio;

class Program
{
    static int PinNumber(char port, byte pin)
    {
        if (port < 'A' || port > 'E')
            throw new ArgumentException();

        return ((port - 'A') * 16) + pin;
    }
    static void Main()
    {
        GpioPin led = GpioController.GetDefault().OpenPin(
            PinNumber('D', 15));//411 blue Discovery
        led.SetDriveMode(GpioPinDriveMode.Output);

        while (true)
        {
            led.Write(GpioPinValue.High);
            Thread.Sleep(100);
            led.Write(GpioPinValue.Low);
            Thread.Sleep(100);
        }
    }
}
//----copy end

Don’t worry about the red lines we will handle it now

  • Right click references on the project pane then “Manage nuget packages”
    -select package source as “package source” (or the you enter during nuget package install)
    -Click browse Select “GHIElectronics.TinyCLR.Devices” Install ->Ok->I accept
    -Click Program.cs Now there should be no red lines.
    -Left click project name select the properties
    -On Tiny CLR OS tab check for device name. It should be “FEZ_FEZ”
    -Press Start
    -After 20 to 30 seconds you should see blinking blue light on the board

-To reprogram the board connect mini usb to power source,micro usb to computer
-Connect a jumper between boot0 and vdd pin and reset this will set the board to dfu mode
-Use dfuse demo to upload “FEZ Bootloader.2.0.3.dfu”
-Disconnect the jumper reset the board
-You should see a new com port
-Connect it with tera term (115200,8,n,1)
-You should see a firendly banner from ghi (“GHI Electronics, LLC Bootloader”)
-Press U enter and When it asks “Are you sure (Y/N)?” Press Y enter
-When you see CCCCCCCC… click (File->Transfer ->XModem->Send)
-On file selection click 1k checkbox on the bottom and select “FEZ Firmware.0.5.0.glb”
-It takes about 10 seconds to upload
-When the upload finishes press R enter when you see "“Are you sure (Y/N)?” press Y enter
-Now device should be ready for programming.

I would like to thank to GHI for giving us such a wonderfull gift :clap: :clap:


#12

@ stateprogrammer - you are very welcome :slight_smile:


#13

@ stateprogrammer -

-Connect it with tera term (115200,8,n,1)
-You should see a firendly banner from ghi (“GHI Electronics, LLC Bootloader”)
-Press U enter and When it asks “Are you sure (Y/N)?” Press Y enter
-When you see CCCCCCCC… click (File->Transfer ->XModem->Send)
-On file selection click 1k checkbox on the bottom and select “FEZ Firmware.0.5.0.glb”
-It takes about 10 seconds to upload
-When the upload finishes press R enter when you see "“Are you sure (Y/N)?” press Y enter
-Now device should be ready for programming.

work

i used X instead U “that is reason that failed to upload firmware”

thanx thanx a lot guys

BLINK work perfekt on Nucleo STM32F411RET6 as is by default



using System.Threading;
using GHIElectronics.TinyCLR.Devices.Gpio;

namespace BlinkTinyCLR
{
    class Program
    {
        public static void Main()
        {
            var controller = GpioController.GetDefault();
            var pin = controller.OpenPin(5);                       // nucleo LED1 on D13 = A5

            pin.SetDriveMode(GpioPinDriveMode.Output);

            while (true)
            {
                pin.Write(GpioPinValue.High);
                Thread.Sleep(1000);

                pin.Write(GpioPinValue.Low);
                Thread.Sleep(1000);
            }
        }
    }
}


#14

@ Dan1 -

USB cuted on mid and used wire which are inside cable

1,power(red wire) connecting 5V to the Nucleo
2,gnd(black wire) connecting GND to the Nucleo,
3.USB D+ (white wire) to PA12 and
4. USB D- (green wire) to PA11

is used for work (and power too) “maybe i’m doing something wrong but it work”