Worlds smallest TinyCLR OS board?

Whats does

Debug.WriteLine("Used: " + Memory.UsedBytes + " Free: " + Memory.FreeBytes);

Give you.

        var freeRam = GHIElectronics.TinyCLR.Native.Memory.FreeBytes;
        var usedRam = GHIElectronics.TinyCLR.Native.Memory.UsedBytes;

        Debug.WriteLine("free Ram : " + freeRam.ToString() + " - used Ram : " + usedRam.ToString());

free Ram : 41456 - used Ram : 39872

firmware
src for firmware
sample code
https://drive.google.com/drive/folders/1oN0vRiyMlEWja5Lt3hXD85kM2at_o9kw?usp=sharing

Your still missing some ram…

I will email you.

Hi Justin,
I’ve tried your last firmware (you sended it to me via email) and it worked well with enough memory for my project. If you are able to free more memory let me (us) know!.

Thank you.

hmmm I must have v1.0 device too… How do you tell difference?

Does it say v1.1 to the left of the USB connector?

1 Like

1.0 have 8 Mhz vs 1.1 have 12 Mhz

lol thought you might say something like that! Could not see anything in the lighting I had.
But took it down to the workshop and yeah can see it now v1.0
My eyes are getting worse!
Apologies!

After downloading GCC/CMSIS (https://docs.ghielectronics.com/software/tinyclr/native/porting.html)
Build for Electron11
Include #define STM32F4_EXT_CRYSTAL_CLOCK_HZ 8000000 to Device.h
Setting approp Vender ID and ProductID
Building .DFU with DfuSe from HEX, deploying OK

Im still getting Unknown USB Device
Or using any firmware .dfu’s above getting very low free ram.
Still confused about what is needed to get latest firmware that works well… Getting late. Tired

Give this a crack - totally untested :joy:

https://store.ingenuitymicro.com/Content/Images/uploaded/firmware/ElectronV1_TinyCLR.zip

Make sure that the below is 5 and not higher as that gobbles ram.

#define DEVICE_MEMORY_PROFILE_FACTOR 5

Also, the scatter file for Electron in GIT is suboptimal…as the values are based on a G30 so missing 32k ram.

2 Likes

Thankyou appreciated!! That seems good!
Fixed “Unknown Device” and ram issue

free Ram : 51504 - used Ram : 38848

Still baffled at what causes the “USB Unknown device”, I am setting the USB Vendor ID and Product ID correctly as per GHI, and also as I have a v1.0 did the #define STM32F4_EXT_CRYSTAL_CLOCK_HZ 8000000 to Device.h

Email me your project files and I will do a diff for a giggle and see what’s different.

Have you defined DEBUGGER_FORCE_API and DEBUGGER_FORCE_INDEX in device.h for some reason?
There’s a bug in the GHI code that prevent initialization of the pointer to USB config struct.

// Copyright GHI Electronics, LLC
//
// Licensed under the Apache License, Version 2.0 (the “License”);
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an “AS IS” BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#pragma once

#define STM32F411xE 1

#include <STM32F4.h>

#define DEVICE_TARGET STM32F4
#define DEVICE_NAME “Electron”
#define DEVICE_MANUFACTURER “IngenuityMicro”
#define DEVICE_VERSION ((0ULL << 48) | (9ULL << 32) | (0ULL << 16) | (0ULL << 0))
#define DEVICE_MEMORY_PROFILE_FACTOR 5

#define USB_DEBUGGER_VENDOR_ID 0x1B9F
#define USB_DEBUGGER_PRODUCT_ID 0x5000

#define UART_DEBUGGER_INDEX 0
#define USB_DEBUGGER_INDEX 0

#define DEBUGGER_SELECTOR_PIN PIN(B, 10)
#define DEBUGGER_SELECTOR_PULL TinyCLR_Gpio_PinDriveMode::InputPullUp
#define DEBUGGER_SELECTOR_USB_STATE TinyCLR_Gpio_PinValue::High

#define RUN_APP_PIN PIN(C, 13)
#define RUN_APP_PULL TinyCLR_Gpio_PinDriveMode::InputPullUp
#define RUN_APP_STATE TinyCLR_Gpio_PinValue::High

#define DEPLOYMENT_SECTORS { { 0x06, 0x08040000, 0x00020000 }, { 0x07, 0x08060000, 0x00020000 } }

#define STM32F4_SYSTEM_CLOCK_HZ 96000000
#define STM32F4_AHB_CLOCK_HZ 96000000
#define STM32F4_APB1_CLOCK_HZ 48000000
#define STM32F4_APB2_CLOCK_HZ 96000000
#define STM32F4_SUPPLY_VOLTAGE_MV 3300

#define STM32F4_EXT_CRYSTAL_CLOCK_HZ 8000000

#define INCLUDE_ADC

#define INCLUDE_GPIO
#define STM32F4_GPIO_PINS {/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 */
/PAx/ DEFAULT(), DEFAULT(), DEFAULT(), DEFAULT(), DEFAULT(), DEFAULT(), DEFAULT(), DEFAULT(), DEFAULT(), DEFAULT(), DEFAULT(), DEFAULT(), DEFAULT(), DEFAULT(), DEFAULT(), DEFAULT(),
/PBx/ DEFAULT(), DEFAULT(), DEFAULT(), DEFAULT(), DEFAULT(), DEFAULT(), DEFAULT(), DEFAULT(), DEFAULT(), DEFAULT(), DEFAULT(), DEFAULT(), DEFAULT(), DEFAULT(), DEFAULT(), DEFAULT()
}

#define INCLUDE_I2C
#define TOTAL_I2C_CONTROLLERS 1
#define STM32F4_I2C_PINS {/* SDA SCL*/
/I2C0/ { { PIN(B, 7), AF(4) }, { PIN(B, 6), AF(4) } }
}

#define INCLUDE_POWER

#define INCLUDE_PWM
#define TOTAL_PWM_CONTROLLERS 4
#define STM32F4_PWM_PINS {/* 0 1 2 3 /
/
TIM1 / { { PIN(A, 8) , AF(1) }, { PIN_NONE , AF_NONE }, { PIN_NONE , AF_NONE }, { PIN_NONE , AF_NONE } },
/
TIM2 / { { PIN_NONE , AF_NONE }, { PIN(A, 1) , AF(1) }, { PIN(A, 2) , AF(1) }, { PIN(A, 3) , AF(1) } },
/
TIM3 / { { PIN_NONE , AF_NONE }, { PIN_NONE , AF_NONE }, { PIN_NONE , AF_NONE }, { PIN_NONE , AF_NONE } },
/
TIM4 */ { { PIN(B, 6) , AF(2) }, { PIN(B, 7) , AF(2) }, { PIN_NONE , AF_NONE }, { PIN_NONE , AF_NONE } },
}

#define INCLUDE_RTC
#define INCLUDE_SIGNALS

#define INCLUDE_SPI
#define TOTAL_SPI_CONTROLLERS 2
#define STM32F4_SPI_PINS {/* MOSI MISO CLOCK*/
/SPI0/{ { PIN(B, 5), AF(5) }, { PIN(B, 4), AF(5) }, { PIN(B, 3) , AF(5) } },
/SPI1/{ { PIN(B, 15), AF(5) }, { PIN(B, 14), AF(5) }, { PIN(B,13) , AF(5) } },
}

#define INCLUDE_STORAGE

#define INCLUDE_UART
#define TOTAL_UART_CONTROLLERS 2
#define STM32F4_UART_DEFAULT_TX_BUFFER_SIZE { 256, 256 }
#define STM32F4_UART_DEFAULT_RX_BUFFER_SIZE { 512, 512 }
#define STM32F4_UART_PINS {/* TX RX RTS CTS*/
/UART0/{ { PIN(A, 9), AF(7) }, { PIN(A, 10), AF(7) }, { PIN_NONE , AF_NONE }, { PIN_NONE , AF_NONE } },
/UART1/{ { PIN(A, 2), AF(7) }, { PIN(A, 3), AF(7) }, { PIN_NONE , AF_NONE }, { PIN_NONE , AF_NONE } }
}

#define INCLUDE_USBCLIENT
#define STM32F4_TOTAL_USB_CONTROLLERS 1
#define STM32F4_USB_PACKET_FIFO_COUNT 32
#define STM32F4_USB_ENDPOINT_SIZE 64
#define STM32F4_USB_ENDPOINT0_SIZE 8
#define STM32F4_USB_ENDPOINT_COUNT 4
#define STM32F4_USB_PIPE_COUNT 4

#define STM32F4_USB_PINS {{ PIN(A, 11), AF(10) }, { PIN(A, 12), AF(10) }, { PIN(A, 9), AF(10) }, { PIN(A, 10), AF(10) }}

1 Like

Hi Justin

Has there been any newer TinyCLR ports for the Electron?

Cheers

Paul

Are you an insider by any chance?

umm, no, bugger…

Then you are missing out. Start here Introducing the SC13xxx Insider's Program

#1 fact you need to realise: TinyCLR OS 2.x and beyond is not going on older devices, it is only for new processor capabilities. And TinyCLR OS 1.0 is an interim step that is now no longer developed - so it’s unlikely that there’s been any effort spent by anyone in the community building out capabilities here.

2 Likes

I am currently focusing on SITCore…

3 Likes

Yep realise that, just have it here and have a application for it because of its small size.
And saw it on Justin’s site, so was just out of interest

ta

1 Like