TinyCLR_CortexM4 source code

Please can provide more info
since there not doc yet

How to switch from usb to uart
And which pins to connect for uart
And any other info regards debug/deploy via uart

Thanx a lot

regard to an old problem
https://www.ghielectronics.com/community/forum/topic?id=24207

did is enoug defination of this to use with serial on STM32F407vgt6 for use RX= PA3, TX= PA2 or need something another via FTDI232RL connector

'#define DEBUG_TEXT_PORT USART2 //instead USB1
'#define STDIO USART2 //instead USB1
'#define DEBUGGER_PORT USART2 //instead USB1
'#define MESSAGING_PORT USART2 //instead USB1
'#define LMODE_PIN _P(B,10)
'#define LMODE_USB_STATE TinyCLR_Gpio_PinValue::High

// Loader
'#define RUNAPP_PIN _P(C,13)
'#define RUNAPP_STATE TinyCLR_Gpio_PinValue::High

'#define UART_DEBUGGER_INDEX 0
'#define USB_DEBUGGER_INDEX 0

hi @Gus_Issa

are you alive (or still busy with creation of docs before August,1)

i’m waiting for any answer(or not) about UART instead USB1 :stuck_out_tongue:

I am sorry, I have 10001 things to complete by Monday :wink:

Question for you: Nucleo F401 board, does it have 8Mhz crystal? Meaning the FEZ firmware will simply work on it?

Can you please start a new thread with your Nucleo board work? Explain how to add a USB connector/cable and where to get your code/firmware?

I would like to add this to the documentation please. You already have all this but it is not in one topic.

:wink: yes i will open thread for that to explain everything

Nucleo F401 have crystal 8 mhz similiar to F411
(because it was used from ST-Link 2.1 Programmer which was included on it)

and info about F401 are there NUCLEO-F401RE | Mbed
i belive FEZ firmware could work simply by default on it but i have no such board since i work with only 411

1 Like

401 and 411 are the same thing essentially.

Take the FEZCLR firmware as is and load on your board. Does it work?

i tested on F411 it work as is well

tested FEZ bootloader 2.0.3
and FEZ firmware 0.5.0

and learned on this forum how to use TERA TERM “and stucked with X instead to use U”

i compiled FEZ firmware and use as is “worked well” seem the configuration of FEZ is similiar to 401 with flash/memory and speed

1 Like

You actually have made what I need PORT of TinyCLR for Nucleo STM32F411RET6 - MB1136 rev.C

But a new one with details and links to GitHub would be great. Do not forget instructions on wiring USB please :wink:

1 Like

THERE

https://github.com/valoni/TinyCLR-Ports/tree/master/Devices/NUCLEO411RET6/Helps

i put everything you need

- compiled firmware
https://github.com/valoni/TinyCLR-Ports/blob/master/Devices/NUCLEO411RET6/Helps/firmware/firmware.dfu

https://github.com/valoni/TinyCLR-Ports/tree/master/Devices/NUCLEO411RET6/Helps/doc

  • picture

https://github.com/valoni/TinyCLR-Ports/blob/master/Devices/NUCLEO411RET6/Helps/doc/Nucleo%20STM32F411RET6.DFU.MODE.pdf

  • dfu mode explained (with usb instruction now uploaded)
1 Like

Great! Added here https://github.com/ghi-electronics/Docs/blob/fix-links-spelling/tinyclr/boards/stm32_boards.md
Will be live on Monday!

1 Like

Just fix info for about fork because i did for 411 which have faster mcu and more ram

Done. Thanks for the help.

1 Like

@Gus_Issa Hi Gus i did some changes instead USB1 changed to COM1

// Debug
#define DEBUG_TEXT_PORT COM1
#define STDIO COM1
#define DEBUGGER_PORT COM1
#define MESSAGING_PORT COM1

#define LMODE_PIN _P(B,10)
#define LMODE_USB_STATE TinyCLR_Gpio_PinValue::High

// Loader
#define RUNAPP_PIN _P(C,13)
#define RUNAPP_STATE TinyCLR_Gpio_PinValue::High

#define UART_DEBUGGER_INDEX 0
#define USB_DEBUGGER_INDEX 0

and connected PB10 to 3.3V(or it should connect GND)
but board do not work with UART FTDRL or I’m doing something wrong

remarks : (burned complete board STM32F407VGT Discovery by jumpering PB10 to GND)

3.3v work

and board on this way work still can flash firmware :smiley:

still can use discovery but no more in ready way as before

1 Like

All that is changing in the coming release.

Connecting a gpio pin to ground will not damage a system. It must be something else.

1 Like

i don’t know what happen but now only uart upload working

no - usb
no - otg
no - 5v power

3.3v power working,too.
all pins (and leds too for miracle working tested code for blink and uart work well)

firmware can upload if i can do with the tricks above
but the only thing stay how to deploy-debug via UART if no usb :smiley:

1 Like

UART debugger now work.
https://github.com/matsujirushi/TinyCLR-Ports/tree/STM32F407G-DISC1

3 Likes

@matsujirushi
i can not compile your code it give me this error

C:\TinyCLRPorts050\Main\main.cpp: In function ‘int main()’:
C:\TinyCLRPorts050\Main\main.cpp:102:55: error: too few arguments to function 'TinyCLR_Result TinyCLR_Startup_SetDebugger(const TinyCLR_Api_Info*, size_t)'
TinyCLR_Startup_SetDebugger(EXPAND(_Uart_GetApi)());
^
In file included from C:\TinyCLRPorts050\Main\main.cpp:15:0:
C:\TinyCLRPorts050\Core/TinyCLR.h:304:16: note: declared here
TinyCLR_Result TinyCLR_Startup_SetDebugger(const TinyCLR_Api_Info* api, size_t index);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\TinyCLRPorts050\Build\release\STM32F407G-DISC1\STM32F4_Startup.gcc.obj: In function Reset_Handler': (i.EntryPoint+0x18c): undefined reference tomain’
collect2.exe: error: ld returned 1 exit status
C:\Program Files (x86)\GNU Tools ARM Embedded\6 2017-q2-update\bin\arm-none-eabi-objcopy.exe: ‘C:\TinyCLRPorts050\Build\release\STM32F407G-DISC1\tinyclr.axf’: No such file
C:\Program Files (x86)\GNU Tools ARM Embedded\6 2017-q2-update\bin\arm-none-eabi-objcopy.exe: ‘C:\TinyCLRPorts050\Build\release\STM32F407G-DISC1\tinyclr.axf’: No such file
Done

@matsujirushi my mistake i copy just folder Device folder now i see also you modified and main.cpp now is OK i’m going testing now with uart i see you modified this part and i belive now we can use in both way
usb or uart

#elif defined(INCLUDE_UART)
TinyCLR_Startup_SetDebugger(EXPAND(_Uart_GetApi)(), UART_DEBUGGER_INDEX);
#elif defined(INCLUDE_USBCLIENT)
TinyCLR_Startup_SetDebugger(EXPAND(_UsbClient_GetApi)(), USB_DEBUGGER_INDEX);
#endif

my dead board “STM32F407VGT6 Discovery” is
back from death with your firmware and work at first attempt uart on my board

now i can “ever” use board with TINYCLR OS 0.5.0 via UART (PA2,PA3) thanx , thanx , thanx a lotttttttttttttttttttttttt
@matsujirushi

on my discovery do not work 5V, SWD ,USB / OTG

but i still can use 3.3V and UART(PC10,PC11 or PB10,PB11) for FLASHING now i’m be able to debug too via UART (PA2,PA3) on my disco board

4 leds - blink example via UART and DEBUG TOOO

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

namespace BlinkTinyCLR
{
class Program
{
public static void Main()
{
var controller = GpioController.GetDefault();

        var pin = controller.OpenPin(STM32F407.PinNumber('D',12));
        var pin2 = controller.OpenPin(STM32F407.PinNumber('D', 13));
        var pin3 = controller.OpenPin(STM32F407.PinNumber('D', 14));
        var pin4 = controller.OpenPin(STM32F407.PinNumber('D', 15));

        pin.SetDriveMode(GpioPinDriveMode.Output);
        pin2.SetDriveMode(GpioPinDriveMode.Output);
        pin3.SetDriveMode(GpioPinDriveMode.Output);
        pin4.SetDriveMode(GpioPinDriveMode.Output);

        while (true)
        {
            pin.Write(GpioPinValue.High);
            pin2.Write(GpioPinValue.High);
            pin3.Write(GpioPinValue.High);
            pin4.Write(GpioPinValue.High);
            Thread.Sleep(500);

            Debug.WriteLine("Led on ..");

            pin.Write(GpioPinValue.Low);
            pin2.Write(GpioPinValue.Low);
            pin3.Write(GpioPinValue.Low);
            pin4.Write(GpioPinValue.Low);
            Thread.Sleep(500);

            Debug.WriteLine("Led off..");

        }
    }
 }

}

2 Likes