32F303 support

Post here first, or if you can't find a relevant section!
User avatar
Pito
Posts: 107
Joined: Tue Dec 24, 2019 1:53 pm

Re: 32F303 support

Post by Pito »

It works fine with original Bluepill board, no changes required.
The crystal is 8MHz, that is ok with the F303CB too.
I had to install the 4k7 R10 for proper USB operation (was not installed on that board).

The flashing via DFU works fine - you have to set the Boot0 header switch to "1", and power on the board,
PC (Win10) recognizes the BluePill (you have to install the drivers), and Arduino (with your STM32 core installed) set to Generic 303CBx board flashes the resulting binary fine.

On the TeraTerm monitor I can see output data (via USB serial). In order to see USB serial you have to have the Boot0 switch in "0" position.

So it builds and flashes properly it seems, the issues could come with details like peripheries, FPU, DSP, and of course the 256kB flash.

The 2x bigger flash is my priority to investigate. I need F303CB to be flashed up to 256kB (my understanding is the CB and CC chips are the same silicon, as it was/is with genuine F103 chips).

In past we had the bootloaders (RogerC era) for 64kB and 128kB versions of the F103 (all my Bluepills with genuine STM32F103 had 2x bigger flash). My F303CB is genuine too.

The original STM programmers are usually looking at the chip ID, so I need an uploader which does not care and flashes 256kB into a 128kB chip as well. I have to investigate.
Pukao Hats Cleaning Services Ltd.
ag123
Posts: 1881
Joined: Thu Dec 19, 2019 5:30 am
Answers: 30

Re: 32F303 support

Post by ag123 »

Well, I've been using this on Linux
https://github.com/stlink-org/stlink
I'm not too sure if it does what you want
User avatar
Pito
Posts: 107
Joined: Tue Dec 24, 2019 1:53 pm

Re: 32F303 support

Post by Pito »

Yup, the standard way works (win10, arduino, Cube programmer)..
Generated a 230kB binary (~15000 lines of code :o ), compiled for the F303CC (the chip with 256kB flash), and flashed into my F303CB (still set as the F303CC) with the standard STM DFU programmer (from Arduino after the compilation automatically).
It took 12secs to flash.
A control calc inside the binary proved it works fine, so the F303CB has got 256kB of flash as well..
:)
Pukao Hats Cleaning Services Ltd.
ag123
Posts: 1881
Joined: Thu Dec 19, 2019 5:30 am
Answers: 30

Re: 32F303 support

Post by ag123 »

256k is quite a bit of flash, normally, I'm less fussy with 'fat' binaries with big flash available.
a thing though is that memory (sram) is the thing we often neglected, sometimes that is an issue and there is little warning when the stack crash into the heap
I'm also suspecting that the more recent compilers and/or libraries generated 'fatter' codes.
Adafruit TFT libraries with the graphicstest sketch + my recent messing with SPI
viewtopic.php?p=15153#p15153
generates binaries about 40k+ sizes
it practically use up the flash budget on a blue pill.

the more recent stm32 chips, I think H5, not sure what others has 'octoSPI' which can map SPI Flash as memory, I think some of the F4xx series has that as well but not called OctoSPI, though I'm not too sure if it can run codes directly from those.
one good thing about that octoSPI is that it can use SPI psram, the older F4xx ones is just flash (read only).
User avatar
Pito
Posts: 107
Joined: Tue Dec 24, 2019 1:53 pm

Re: 32F303 support

Post by Pito »

You may remember my quite long thread in the "old stm32duino" forum (perhaps around 2016-17) where I installed 512kB of external sram on my two boards - F103Z and F407Z (they had pads for an external sram). I published several variants of using it - ie. as an executable sram, or as the Heap - with the measurements/performance results.

So to wrap up - the F303CB offers 32kB of sram and 256kB of flash, no special bootloader needed, standard STM tools work, also it seems to me its ADC is quieter on the first glance, and it is a CM4F..

A nice upgrade option if you have old Bluepills in your junkbox and a bit better chips handy (almost any 48pin stm32F may work that way, imho, they are mostly pin compatible).
Pukao Hats Cleaning Services Ltd.
ag123
Posts: 1881
Joined: Thu Dec 19, 2019 5:30 am
Answers: 30

Re: 32F303 support

Post by ag123 »

something I liked about the F303 is its 4x5 msps ADC + other analog capabilities DAC, opamps, comparators etc.
I bought a board or 2 intending to work that into a usb oscilloscope or even a small digital electronics lab given its capabilities, e.g. a transistor characteristics plotter.
but I never quite worked that project and after some time stm32g431 came out
https://www.st.com/en/microcontrollers- ... 431cb.html
https://www.st.com/en/microcontrollers- ... 431rb.html

these didn't come to match the capabilities of F303 ADC 4x5 msps the g431 has 2x4 msps ADC.
the benefit of g4xx is that it is practically an f4xx (with all that ART accelerator (on chip cache), FPU, etc) and significantly higher cpu clock speeds, then plus similar analog pheriperals from the F303 (adc, dac, opamp, comparators).

intitially I wanted to bridge that 4x5 msps ADC across usb but that usb full speed 12 msps is 'too little' (usb cdc serial is even lesser max out at about 1.5 Mbps ) to even meet that high bandwidth of the 4x5 msps ADC. The options if I wanted to do that turned out to be expensive, e.g. to find some devices that can bridge usb 2.0 high speeds (480 mbps) and offer a means to bridge say over some parallel interfaces, and I think the speeds needs to be pretty fast too given that 4x5msps ADC even at 8 bits is 20 MB per secs (160 Mbps for 'raw') speeds.
User avatar
Pito
Posts: 107
Joined: Tue Dec 24, 2019 1:53 pm

Re: 32F303 support

Post by Pito »

Yep, there are much faster and better equipped chips available today..

Btw. - the first thing I want to try is the "simultaneous operation of two ADCs" in that F303.
DS/RM say it is possible, but I have not found an example.

When you perhaps know about a chunk of example code how to make it working straight I would be happy (we may discuss in a different thread then)..
Thanks,
P.
Pukao Hats Cleaning Services Ltd.
ag123
Posts: 1881
Joined: Thu Dec 19, 2019 5:30 am
Answers: 30

Re: 32F303 support

Post by ag123 »

btw one of those solutions I looked into to do high speed usb interfacing with stm32 is FT2232H or FT232H

https://ftdichip.com/wp-content/uploads ... T2232H.pdf
https://ftdichip.com/wp-content/uploads ... FT232H.pdf
these chips can do usb 2.0 high speed 480 Mbps

Adafruit has one of them
https://www.adafruit.com/product/2264
a search for FT232H in Aliexpress, Amazon, Ebay etc would turn up the 'competitors'

This is probably capable of streaming that 4x5 Msps ADC at full speeds to the desktop, it matters as otherwise, what is feasible is perhaps a 1 to few k samples 'window' displayed per sweep on the 'oscilloscope' screen.

at 20 Msamples per sec, that is 20 MB per sec in 10 secs that is 200 MB and in less than 2 minutes 2 GB :P

earlier on I looked at usb high speed transceivers on stm32f407 etc, only the bigger chips have them, the ulpi transceiver chips would be like usb3300
https://ww1.microchip.com/downloads/en/ ... 01783C.pdf
for that matter one can literally buy a board with those e.g.
https://www.aliexpress.com/w/wholesale-usb3300.html
https://www.aliexpress.com/item/1005007949324975.html
https://www.aliexpress.com/item/1005006413089415.html

a trouble is I've no confidence interfacing a bunch of dupont wires more than 8 wires that need to operate at 60 Mhz pumping 8 parallel bits through the ULPI interface.

there are also challenges on the stm32 side, on the one hand, we'd need to figure out how to do 4x5 msps with DMA, and that likely means to memory only. Then that from memory, it is also necessary to do one of the esoteric 'timer driven' DMA that pumps memory at Mbytes speeds to gpio pins so that it can perhaps interface the FT232H.

I think it is quite an achievement for an mcu to be able to do this, I'd guess more traditionally belongs to ASICs or FPGA arena,
but whether if this is literally even feasible is still unknown, not tried yet.
a notion is that FT232H + stm32f303 = 20 Msps digital storage (usb) oscilloscope

I checked some high speed DSOs many offering 100 Msps and beyond, I'd guess those are either FPGA, ASICs or some sort of that.
there are a lot of things that an mcu alone can't do, even for that matter interfacing usb 2.0 full speed 12 mbps, I can't find an 'easy' way to do a 'serial interface engine' even if you can buy 'cheap' usb full speed transceivers e.g.
https://www.onsemi.com/download/data-sh ... 105a-d.pdf
I think it may still be feasible with the faster mcus, but that it would be a "waste" of processors just for that purpose, but it won't be simple to implement say on a stm32 f0 or g0 device.
User avatar
Pito
Posts: 107
Joined: Tue Dec 24, 2019 1:53 pm

Re: 32F303 support

Post by Pito »

I do not target to go 5Msa/s today, my goal for today is to get the simultaneous regular mode working..
I worked with HAL last time in 2016..
The high speed transfer is the next step..
I am going to start a new thread on that..
Pukao Hats Cleaning Services Ltd.
ag123
Posts: 1881
Joined: Thu Dec 19, 2019 5:30 am
Answers: 30

Re: 32F303 support

Post by ag123 »

OT out of curiosity, I took a look at a high speed 95, 105 Msps ADC
https://www.ti.com/lit/ds/symlink/adc12c105.pdf
these apparently use clock driven parallel data buses
then that some higher speeds ones are on LVDT and some at clock speeds that are 'beyond MCU' levels e.g. ghz.

Apparently, if I simply want to use that FT232H and doing a usb oscilloscope, this might be a possible 'solution'
https://www.ti.com/lit/ds/symlink/adc08060.pdf

I'd think given the nature of usb buses, that 60 Msps won't be 'continuous' it'd be interrupted when usb host multiplex to other connections.
That may mean only 64 bytes frames can be transmitted at a time and the host multiplex to other connections.

In this light f303 may still be a 'better option' as it may buffer just enough samples between multiplexing interruptions for a next transfer to FT232H
Post Reply

Return to “General discussion”