Creating a low-cost pin-compatible Arduino/Due board using an STM32L471

darn it i really really want to use the 072 as, being fully programmable, it's a lot less risk. if there was any other tiny processor with USB that was $0.50 i'd use it, definitely. i'm actually having to think, here, make sure i get the BOOT0 handling right: an 072 i could just wire up a GPIO to it and be done, because errors in design could be taken care of with firmware. sigh...

if there was any other tiny processor with USB that was $0.50 i'd use it, definitely.

I'd be shocked if there isn't some Chinese product that would work. STC, perhaps?

is the layout cleanup automatable?

Not that I know of. It's a lot of pushing tracks around "a little bit", ripping up and re-routing a small subset of them at a time, and stuff like that, trying to make things look "even" and pretty without changing the electrical at all. Some people hate it...

westfw:
I'd be shocked if there isn't some Chinese product that would work. STC, perhaps?

nom, nom, nom... GitHub - grigorig/stcgal: Open Source STC MCU ISP flash tool hmmm never heard of STC before... oh look! they're used in those ubiquitous PL2303-based things, ha, funny. doh, an app note for an STC15 actually uses... an SOP-8 PL2303 to do USB-to-UART, doh!

Not that I know of. It's a lot of pushing tracks around "a little bit", ripping up and re-routing a small subset of them at a time, and stuff like that, trying to make things look "even" and pretty without changing the electrical at all. Some people hate it...

oh that! yeah i love doing little minor track-thingies. means i get to do a careful thorough review at the same time.

yeah knock yourself out, let me just do a make upload, i have about 2 other boards i should be focussing on (and a prototype to assemble). one thing, if you look closely at the ADC tracks some of them come in on BOTTOM, some on TOP, all into the same area (very very tight). they were parallel to each other in a big group. what i've done is deliberately pushed them 45, then 90, then 45, in opposite directions so as to get as much of the sets of tracks at right-angles to each other.

i'm keeping "Stop" layer switched on, it shows a keepout area around the octagonal VIAs, which i've found very handy for all this manual checking of clearances.

I2C is along the top between pins 20/21 to the r3 equivalents, it's hard against the board edge (no GND plane), if you think of a better way to do that, feel free.

if you want a challenge tidying up the right-hand connector area to get some GND in between the pins, i discovered that you can actually fit a signal VIA or a GND via and still juuuust about get a track round it on two sides, by putting the VIA near-hard up symmetrically against two of the 2.54mm pins. you can only get 1 track in between any 2 given 2.54mm pins (tried getting 2... even when setting grid to 0.625mil.. doesn't work) but you can have one track come in East, go out North whilst another track comes in West and goes out South... you just can't get a VIA in the middle as well if you do that. but, TOP coming in North going out West, and BOTTOM coming in South going out West you can get a VIA in, jammed up against the East side. never used octagonal pin shapes before: quite like them now.

the other area that's a little dicey is just above the 32.768kHz XTAL, running from the top-left corner of the MCU to round where the words TX, RX and 1.0 are. there are tracks running horizontally parallel to each other, not too happy about them.

looking at it now, i think the set of VIAs just above C1 and C2 could all move to the left of C1 and C2, above the MicroSD card, then the tracks PE1, PE0 and PD7 currently running through the words "V1.0 TX RX" could all also be shifted down, running 45 degrees below the word "RX", which would make them at 90 degrees to the BOTTOM tracks on the other layer.

i figured also get an extra couple of VIAs in round the 32.768khz XTAL whilst at it... anyway do you want to tackle that? you're more than welcome. i'm not going to be sending this off for prototyping for at least... a week (or until i'm happy with it).

This looks great! Especially as the Otto will probably be delayed forever. Put me down for two boards. :slight_smile:

I've been frustrated with the cost of 32 bit boards as well, there are the STM32 "pills", some Uno sized boards, but nothing suitable in the Mega format. I would really like something that is a drop-in replacement for Due so it can be used with shields for 3D printers.

I don't have a lot of time (moving house), but if you have a prototype design I can convert it to KiCad.

bobcousins:
This looks great! Especially as the Otto will probably be delayed forever. Put me down for two boards. :slight_smile:

cool! i can do that :slight_smile: GrumpyOldPizza's repo would be one place to start if you want an arduino-compatible interface, but also libopencm3 supports the STM32L4 libopencm3: libopencm3 Core CM3

I've been frustrated with the cost of 32 bit boards as well, there are the STM32 "pills", some Uno sized boards, but nothing suitable in the Mega format. I would really like something that is a drop-in replacement for Due so it can be used with shields for 3D printers.

funny you should mention that.... RAMPS 1.4.2 fork: RD3D v1.0 (6 steppers, 24v, Due)

I don't have a lot of time (moving house), but if you have a prototype design I can convert it to KiCad.

yeah sure, knock yourself out, git clone Index of /~lkcl/stl47o/.git and use wget on the directory below to grab all the datasheets etc. i tend to just... drop all the PDFs into the main directory, all a bit messy i know but it means they're there when i need then, no need to think too hard :slight_smile:

Wow - A lot changed since the first time I looked at this! There was less to clean up, too.

Updated versions in [/url]https://drive.google.com/drive/u/0/folders/0B6dMB5dovDUZYzhjY2M1NmEtZmI2NC00MDZkLTliODMtOWYzNjQyZmViNWEy[/url]

A couple design comments:

  • Using an SMT reset switch might be advantageous, and cheaper to assemble.
  • Does your micro-SD socket allow traces underneath the socket? Some don't...

"Review" comments:

  • A lot of what I did was "centering" traces leaving the ARM SMTs. There are "issues" with routing grid vs IC grid, and a lot of them had little tiny diagonal trace segments causing the traces to be off-center. Most were barely noticeable, and I don't know if any were "dangerous", but they're all centered now.
  • I increased the power trace clearance to 10mil and did a DRC check to ensure that all the traces/vias conformed EXCEPT for the ARM itself (whose pins are not 10mil apart!)
  • This was mostly accomplished by shifting GND vias a tiny bit toward the center of their flood areas. I eliminated a couple gnd vias for not having any relevant flood on one side or the other, and being otherwise difficult to get to conform.
  • You probably want most of the Vias tented. Do this by modifying the "limit" parameter of the "masks" DRC panel. In my version I set it to 0.5mm (so all vias 0.5mm or less will not have solder mask holes.)

I'd say ditch the Arduino "dog ear styling" and go with plain rounded corners, like we did for "Freeduino", but that's just me being style-less :slight_smile:

westfw:
Wow - A lot changed since the first time I looked at this! There was less to clean up, too.

yehyeh, it's quite common that i'll do one layout then learn from that, chuck the lot and do it again, better.

Updated versions in [/url]https://drive.google.com/drive/u/0/folders/0B6dMB5dovDUZYzhjY2M1NmEtZmI2NC00MDZkLTliODMtOWYzNjQyZmViNWEy[/url]

whoops, schematic's there, but the brd file is a zero-length file!

A couple design comments:

  • Using an SMT reset switch might be advantageous, and cheaper to assemble.
  • Does your micro-SD socket allow traces underneath the socket? Some don't...

hm good idea on the reset switch, i'll look one up. i'll not make any changes yet though, don't want to lose sync with what you've done. sd: yeah it does, it's a very common cheap chinese one that has plastic underneath not metal. i still put a ton of VIAs under it, even though it will only be running at SPI speeds.

review comments look good... i'll be able to respond to when the brd file isn't zero-length any more... :slight_smile:

I'd say ditch the Arduino "dog ear styling" and go with plain rounded corners, like we did for "Freeduino", but that's just me being style-less :slight_smile:

:slight_smile: Me and Mr Eagle CAD are not Best Mates, i would have to learn how to do that and also get over the "workman blaming the tools" syndrome... :slight_smile: i know how it's done in PADS: select two edges, right-mouse, select "stretch arc". easy.... sigh...

whoops, schematic's there, but the brd file is a zero-length file!

Grr. Google Drive apparently doesn't like firefox very much. Things went better with Chrome, and I've uploaded a combined .zip file...

i would have to learn how to [reshape board outline] ... select two edges, right-mouse, select "stretch arc".

Draw new edge in "dimension" layer, use "miter" tool on corners. Delete old edge... (uploaded a "-rounded" version as well.")

westfw:
Grr. Google Drive apparently doesn't like firefox very much. Things went better with Chrome, and I've uploaded a combined .zip file...Draw new edge in "dimension" layer, use "miter" tool on corners. Delete old edge... (uploaded a "-rounded" version as well.")

awesome. ok will take a look!

westfw:
Grr. Google Drive apparently doesn't like firefox very much. Things went better with Chrome, and I've uploaded a combined .zip file...Draw new edge in "dimension" layer, use "miter" tool on corners. Delete old edge... (uploaded a "-rounded" version as well.")

ok so that's committed and uploaded, went over it - really appreciated what you've done.

i did that re-routing around C19 (top left of MCU), i feel happier with the tracks top and bottom crossing at right-angles or 45. also the GND connectivity to C19 was a bit... tenuous: moving the tracks around allowed me to put some better GND connectivity in, jumping several times between the planes.

put in the SMT switch (thanks for the suggestion!). also i am a bit... funny about adding in GND VIAs, i think in 3D, so added some as a 3D barrier around the ADC traces where they come in to the MCU. also there's some areas where i add them to join pieces of GND flood-fill together. on one layer it's GND then track and on the other it's track then GND, and there's this little bit in between where you could fit VIAs in between and get a contiguous GND connection.

it's all the little bits that add up, y'know?

i also really appreciated that you managed to get some GND in between that right-hand connector pins, i was able to add some more in.

btw westfw, i put the GND/Power clearance back to 8mil not because i disagree that it should be (i haven't moved tracks closer) but because when tStop is enabled there's over i think it was 180 DRC violations (!) all on the MCU...

aaaa the flood-fill changes if you alter the POW net class clearance!!! aaaa must remember to put them back to 10mil when doing the gerbers.

i reaaally don't want to have to hit "Approve" on over 180 DRC errors, i might miss one or two of them. or ten. westfw is there a way to do component level DRC like you can in PADS, Altium etc., do you know?

i put the GND/Power clearance back to 8mil

I meant to do that, but I got tied up when I forgot which one(s) had always been 10mil, and forgot to look it up.
I also didn't look at the DRC before changing things...
Hmm. Ok, thanks to the backup files.... ALL the signal clearances were at 8mil, and when we return to that the only DRC warnings are for the mounting holes (on both original and modified versions.)

the flood-fill changes if you alter the POW net class clearance!!!

You can change the clearance of the flood separately from the signal clearance using the "change isolate x" command on the polygons. I like the way it looks with a 14mil "isolation" parameter - that's nicely separate, but still floods between the connector pins.

is there a way to do component level DRC

not that I know of.

HA! found one. http://www.engtaobao.com/item/559452178207.html

STM32F070F6. i think this might have been the one you were referring to, westfw, and i got it confused with the 072. this guy on taobao, very sensible: each one is USD $0.16... he then charges USD $28 for shipping (flat-rate). so... buy 1,000 and you're good. buy 10,000 and you're laughing.

what that means is though that i'd stand a good chance of getting it reaaally cheap in the huaqiang road markets.

even the prices on ST's web site - $0.50 or so for 1k volumes - are good. crystal-less USB operation, UART, GPIO, SPI. i could put up with that. hell i'd be happy to try to run the SPI wires over to it and wire up SPI and a CS to that last remaining GPIO on the 471, try making it a slave SPI device to get better data-rates when communicating on its USB interface. up to 18 mbits/sec full duplex where the USB interface actually only goes up to 12.

the only thing: it's not OTG, it's plain USB. but still, plain USB is better than a kick in the teeth.

ha, connecting it to the SPI interface would allow direct boot-level reprogramming of the 471. HA!

still owe you a reply on your last message, westfw - haven't forgotten about it.

argh! did... did this just appear in the past couple of weeks? http://www.st.com/en/microcontrollers/stm32l496ve.html if not.. how the heck did we manage to miss it??

[edit] anyway... thought about it... it's too modern. pricing on taobao is higher than st's own distributors. plus, for an auto-reset/boot0 you still need an extra MCU/USB-UART IC to manage it, even though it has native OTG. arrangement would have to be similar to the due (dual OTG interfaces) and that's a big redesign (too big).

so... stick with this design for now. bit of a surprise on the STM32L471 datasheet: not only is it missing USB it's also missing an SPI-based bootloader. looks like there were a few screw-ups at ST during the fab / layout on this one. all the other ICs in this family/range have OTG and SPI-boot.. hmm....

westfw:
I meant to do that, but I got tied up when I forgot which one(s) had always been 10mil, and forgot to look it up.
I also didn't look at the DRC before changing things...

not a problem.

Hmm. Ok, thanks to the backup files.... ALL the signal clearances were at 8mil, and when we return to that the only DRC warnings are for the mounting holes (on both original and modified versions.)You can change the clearance of the flood separately from the signal clearance using the "change isolate x" command on the polygons. I like the way it looks with a 14mil "isolation" parameter - that's nicely separate, but still floods between the connector pins.

cool. well, i left it at 10mil and it seems to be ok. the 180 DRC errors seem to have gone walkies..

anyway i'm going over the board again and again (i tend to do that), dropped in that F070 and it looks really good. noticed that CANTX/RX are also ADCs but go up to the top of the MCU so tried to get a bit of GND around them...

man the pins disappeareed fast on the F070! there's 3 GPIOs left. i really should wire up the SWCLK/DIO to the F070, that would be neat: allow remote-debugging over the serial link, like with the NUCLEO boards. however doing so would disrupt the GND plane which is already quite dicey around C19.

just noticed another bit of parallel-tracks that need moving... does this ever end? :slight_smile:

STM32F070F6

I don't think that it allows crystal-less USB operation, though. :frowning: Sure fits nicely, though (SSOP20 vs SOL16, eh? Interesting the way that works out.)
flip/pinswap the reset switch so the reset signal doesn't have to snake around so much? Or is that intentional?
I'm a little worried about the uSD card having room to slide out...

Newer Arduinos have simplified the op-amp part to only use a single op-amp, which would theoretically permit use of a smaller package. (OTOH, they're using the send opamp as a buffer for the L led.)

westfw:
I don't think that it allows crystal-less USB operation, though. :frowning:

deep breath.... argh you're right. i remember looking at the 64-pin F070 and then selecting the 64-pin 072 instead ... then forgot that the 070s don't operate crystal-less argh.

Sure fits nicely, though (SSOP20 vs SOL16, eh? Interesting the way that works out.)

yeh it does... but ngggggh the extra cost of the crystal takes the BOM up to around $0.70... is it worth it? i'm tempted to say yes.

flip/pinswap the reset switch so the reset signal doesn't have to snake around so much?
Or is that intentional?

the 5th pin on the switch means i'd have to move the ... no it doesn't: managed to shoe-horn it in. will update.

I'm a little worried about the uSD card having room to slide out...

i think it'll be ok. those components aren't that high (R8), LED (marked PWR). if nothing else the uSD card will go over the top of them. if there was a 1206 capacitor or a pinheader i'd be concerned.

Newer Arduinos have simplified the op-amp part to only use a single op-amp, which would theoretically permit use of a smaller package. (OTOH, they're using the send opamp as a buffer for the L led.)

... because it's there, most likely. any schematics around that you know of that i can copy? is it worth shaving the cost by reducing down to a single op-amp? (answer's yes...) so have to find a single-channel op-amp... what's equivalent? LMV321? http://www.ti.com/lit/ds/symlink/lmv358-n-q1.pdf says so...

although it doesn't look very much lower in cost!! LM321 data sheet, product information and support | TI.com $0.19 in 1k volumes...

UA741 UA741 data sheet, product information and support | TI.com is $0.12 that's better....

honestly the last time i used op-amps was at school, and that was... um... 1985? :slight_smile: help!

found one - https://www.arduino.cc/en/uploads/Main/Arduino_Uno_Rev3-schematic.pdf

uses a resistor divider, 2x 10k resistors, through the op-amp... onto the gate of aaa.... FDN340P which is a..... single P-channel MOSFET. hey it's the same one already being used.

err... errr.... that's what's in the PDF of the mega2560 schematic! damn it this sort of thing pisses me off: the reference design that arduino.cc released (the actual eagle files) are hopelessly out-of-date. yes you can just cut the 2nd gate completely out of the circuit. ngggggh.

ok so that's done... but i'm still really uncertain about what (low-er cost) single-channel op-amp to put in its place?

lkcl:
UA741 UA741 data sheet, product information and support | TI.com is $0.12 that's better....

honestly the last time i used op-amps was at school, and that was... um... 1985? :slight_smile: help!

uA741 is very old maybe in 1985 you used it !

that's what's in the PDF of the mega2560 schematic! damn it this sort of thing pisses me off: the reference design that arduino.cc released (the actual eagle files) are hopelessly out-of-date.

When and where did you get your copy? The versions I see now at https://store.arduino.cc/usa/arduino-mega-2560-rev3 look updated and current.

uncertain about what (low-er cost) single-channel op-amp to put in its place?

LMV321 ? Seems to be available from several vendors, and on ali-express for cheap. Beware the non-V version, which isn't a rail-to-rail-y.