Это видео недоступно.
Сожалеем об этом.
#155
HTML-код
- Опубликовано: 25 июл 2019
- Programming the STM32F103C8T6 is easy using an FTDI USB-to-Serial dongle.
$5 for 10 PCBs www.pcbway.com
First order free! 2-sided PCB just $5 for 10 pieces. Assembly for 20-pieces just $30.
Plug one end into your PCs USB socket and connect two wires to the STM32 (plus power).
Visit my GitHub for all this info + links and more information including the KiCAD project files.
github.com/Ral...
So using the FTDI to program the STM32 is great.
Until the wires come off and you spend ages plugging it back in (wrongly). This PCB does away with all the hassle and lets you program an STM32 in seconds.
I was frustrated as not getting the USB socket working as expected on my "Blue Pill" STM32 board and reverted to an equally good way of connecting it to my PC with an FTDI dongle.
But it needed a better and more secure way of connecting the two devices so I designed a PCB from PCBWay to help me. Whilst I was at it I included a couple of LEDs and a switch to obviate the need of the jumpers. Oh, and big, red RESET switch!
Watch the video for much more information!
==============================================
LINKS to item shown in the video.
Affiliate links help my channel financially at no cost to you.
As an Amazon Associate I earn from qualifying purchases.
==============================================
On offer until July 31st, 2019 $1.49 each
Geekcreit® FT232RL FTDI USB To TTL Serial Converter Adapter Module For Arduino
www.banggood.c...
CJMCU CP2102 USB To TTL/Serial Module Downloader For Arduino
www.banggood.c...
RobotDyn® USB Serial Adapter CH340G 5V/3.3V USB to Ttl-uart For Arduino Pro Mini DIY
www.banggood.c...
Blue Pill STM32F103C8T6 Small System Board Microcontroller "Blue Pill"
www.banggood.c...
Black Pill (UK link via Amazon)
amzn.to/2JWYUSB
Black Pill (Chinese link)
STM32F103C8T6 ARM STM32 Minimum System Development Board
www.ebay.co.uk...
ST-LINK Geekcreit® 3.3V 5V XTW ST-LINK V2 - less than $3
www.banggood.c...
The KiCAD project, board, Gerber files etc. "Blue Pill Shield"
All on my GitHub. Download to a folder on you PCB, unzip and open the project (.pro) using KiCAD.
"Beginning STM32" book. I've got this excellent technical book and it's bare metal programming using freeRTOS, libopencm3 and GCC. I'm slowly working my way through it. Not for the faint-hearted but it is absolutely superb, the bees knees!
amzn.to/2JYZwHo
If you like this video please give it a thumbs up, share it and if you're not already subscribed please consider doing so and joining me on my Arduinite journey
My channel and blog are here:
------------------------------------------------------------------
/ ralphbacon
ralphbacon.blog
------------------------------------------------------------------
Mate, add mounting holes in the four corners with your next board. Then use standoffs to keep the board off the table. It will pay off.
Indeed, Douglas, good idea for V2! My Home Alone project has this, of course, so I could mount it on the coaster. For this board I currently put four "drawer buffers" underneath; they are very slim, transparent, plastic stick on circular pads to stop drawers slamming - but also are great non-sleep feet for circuit boards. Thanks for posting.
The last time I watched one of your videos, you were still wearing glasses (got some catching up to do). Thank you for being such a great educator, once again.
I still do wear glasses but am wearing contact lenses now in an attempt to let me see with my dodgy cataracted eye (is that a word?)
Tip if you want shiny text as well as or instead of silkscreen... Move the text to an outer copper layer and make sure that solder mask doesn't cover the text. "Secret" messages can be embedded in inner copper layers or, more obviously, outer copper with solder mask. Also useful to know if it's cheaper to make a board without silkscreen. 😋
I never thought of doing it this way, Bernd. But the visible copper will tarnish over time, right? But I like the 'secret' message in an inner layer. I wonder if an on-board device could detect the presence of copper underneath it, for example, as a means of stopping clones?!
Happy to see that, despite the hiccups you run into, you keep on keeping on 😁 Your perseverance inspires me. 👍 Thanks.
Well, this is a temporary solution (we all know how they become permanent) and it's surprising how many of you have responded that you too have had issues with the USB that never got resolved. So now we don't need to resolve them! And we get more program space! Win win!
Thanks to your previous video I bought a Blue Pill and thanks to the video by Andreas Spiess I tried out platformio. I was delighted to discover that when using the ST-Link cheapo Chinese programmer, not only could I upload sketches to the STM32 with platformio, but it also works as a debugger. Break points and single stepping through the sketch works perfectly. All I had to do was put two lines at the end of the platformio.ini file for the project.
"debug_tool = stlink
upload_protocol = stlink"
The only issue I had is that my Blue Pill was one of those cheap Chinese clones you mentioned and the st-link software that gets installed by platformio did not recognise the CPU ID. The solution was to install st-link from source using the current github master and symlink it into platformio at ~/.platformio/packages/tool-stm32duino/stlink/ as well as edit ~/.platformio/packages/tool-openocd/scripts/target/stm32f1x.cfg to replace line 42 with
set _CPUTAPID 0x2ba01477 (Dunno where those files would be in Windows)
If you have a genuine STM32 it should all work out of the box.
Also for using st-link you don't have to change these jumpers
Certainly line-stepping debugging is something I want to get working and not just on this board! I have Visual Studio Code and Platformio running at the moment so it's pretty high on my list. Thanks for the technical heads up, I'm sure I will need that.
@delboy4711 On Windows, %userprofile% points to the user home directory, just like ~ does on Linux, so %userprofile%/.platformio/packages/tool-stm32duino/stlink/ will take you to the same place on a Windows box ;) And great to know you're another PlatformIO users... there have been quite a few people jumping on board because of Andreas's video... really good to see more people giving it a try! :) :)
Thanks for the Blue Pill content. You're one of the only people covering the STM32F103 series. I like these pcbes a lot; cheap, versatile, and fairly easy to use.
I'm happy you're enjoying the content! Without a doubt, the Blue Pill is what the (new) Nano should have been. I wonder why Arduino.cc didn't go down that route.
The Arduino community is lucky to have a person such as you to point them out to the many hurdles of community based projects. Who would have thought electronics can ever be a hobby of choice for the many people around the globe? You might think this is quite an embellished praise, you have to see it from my perspective. When I talk technobable to my friends, I get booted out of the door only if a window was not an option. Ralph, love your vids, please make more. Thank you.
I have the same problem as you: no-one to share this incredible tecnostuff with! OK, I do have a professional electronics engineer friend to mull things over with but there is only so much he can listen to before his eyes glaze over! He doesn't chuck me out though. But I do have the incredible community here, which makes it all worthwhile. Thanks for your supportive comments, most appreciated.
The "bricked" FTDI chips scandal somehow passed us Linux users by, hehe. Also, you can unbrick them by changing the PID that the naughty driver sets to 0x0000 back to 0x6001. Not that it matters at all to me since I do actually own a genuine FTDI cable along with a few clones and assorted alternatives. Basically FTDI in their infinite wisdom (insert laugh here) shot themselves in the foot with their tomfoolery.
Yes, they were foolish to punish the end-user, that's for sure. But your Linux smugness will one day be your undoing, Nick, mark my words, come the Microsoft Windows revolution all the 🐧Penguins will be ⚡ bricked first! What do mean Microsoft now has a subsystem for Linux? What??!!!
I am struggling with the fact you can't get the Blue Pill to work as a stand alone USB device. The big problem with the "off the shelf" Blue Pills is that there is an error in the hardware. The resistor on the underside - R10 - is wrong. If you either replace it with a 1.5k SMD or remove it it and use a conventional 1/8 resistor from 3.3V to pin PA12. Once that has been done connect your FTDI to PA9 and PA10 and burn the Roger Clark "generic_boot20_pc13.bin" from Github using the STM program "Demonstrator GUI".
There is quite a lot How tos' on how to do this. Once done Arduino will recognize the board as a "Maple Mini" and you would use the "STM32duino bootloader" as the upload method. Sorry to ramble on but it is a shame that such a powerful and CHEAP little board is not being used. I have flipped a lot of Blue Pills using this method. Once done it is treated as a simple USB device, no switching links on resets. The Black Pill is the Blue Pill without the hardware errors. The key is the upload method and how you set the little boot yellow links. Categorically they work well as a USB on the Arduino platform AND they support 128k
Believe me, MIke, I am struggling too to believe this. I've already done everything you've stated and the bootloader was flashing its series of quick and short flashes - then "USB device not recognised". That said, I've got it all working on the 'clone' boards I've got (with the CKS32F103 chips) and it even works with the GD32F103 ones too. It's just the original ones it doesn't want to play with. Typical! But I'm not giving up, just having a rest whilst I concentrate on other things.
Sometimes you've just got to bite the bullet and go with the Teensy LC
It's hard to get a legit Black Pill in some parts of the world, or cost prohibitive. But I might try to pick some of them up soon.
@@RalphBaconI found that too at the beginning and the answer was simply to rearrange the boot links to both being on 0 and 0
Hi Ralph! I recieved the board yesterday. Thank you so much!! :)
You're Welcome, Stephen. You will also have noted that I included the slider switch and reset switch because the board was designed with those in mind - use them or not, as you desire! Did you see my V2 version (same board, different way of putting it together):
www.dropbox.com/s/qno1c1bi7pe6gbq/V2%20Snapshot%20Hi%20Res.jpg?dl=0
Don't forget to swap the LEDs and resistors over to make the red LED very visible. Oh, and use a 10K for the green LED to stop it dazzling motorists in the next town!
Interesting project as always
FTDI can also go 5 og 3.3 V programming voltage, That is a good reason to select this programmer/RS232 converter
Thanks for sharing :-)
Indeed, that is a good reason, Asger. I use 5v on my board because there could be other peripherals requiring that voltage.
I've just checked my FTDI adapters and at least *one* of them is genuine; the others are not, however, hence the very low price. Luckily FTDI no longer bricks counterfeit devices, although as these do not pretend to be FTDI chips maybe they are safe? Maybe! So difficult to know, although a low, low price should be a warning. Thanks for posting, always good to hear from you.
Good work Ralph, keep up the perseverance. I'm looking forward to your revised speed tests. It looks as though the USB program loader takes up about 20k of program space. if you have the 64k version of the STM32, its quite a sacrifice.
Don't tell anyone, Andrew, but the chances are you have 128K on that device. Just not officially. Without the USB bootloader you don't sacrifice any space so my way of doing it does have a beneficial side effect too. Got your communique, all OK.
Nice work as usual.
It seems you can swap the resistors and LEDs to get a better view.
On version 2, you might want to move the LED's to each side of the switch to make it clear what mode you are using.
If you do make a version 2, why not build the FTDI directly on the board, it is just a few components, of course it means that SMD thing again but it seems you are getting better at it :)
Flemming you are definitely thinking outside the box! Moving the LEDs to where the resistors are (and vice versa) solves the problem completely. You're a star!
As for putting the components directly onto the PCB it seems that FTDI don't make chips that cheap I must have a 'clone' - so I would have to desolder my FTDI module to use whatever chip that is, etc etc - a bit too much trouble. I'll show everyone the resoldered board in due course. Thanks so much for the suggestion!
@@RalphBacon "thinking outside the box" thank you - some of my boss's has accused me of that :)
I thought that agreed that it's not about cost, "not worth the time and effort" video #133.
It must always be about the joy to make an idea work to the best af your ability, a few pound here and there doesn't really matter much.
- Of course it can get to expensive but then we might not do the project at all.
If I had had more time for that heater repair (video #133) I would definitely have made a PCB. At the time I didn't have either time or the confidence (ie skill) to do it. How things change! And a big yes to that "a few pounds here or there". Mostly it's "cup of coffee" or "a pint of beer" cost, this hobby. And we have a great little project at the end of it! Keeps the grey cells from turning to mush, too.
@@RalphBacon Great ideas, i was thinking along the same lines. Thinking out side the box again, you could remove the 3 wires by reversing the connector. Modify your blue pill to have them on the reverse side. They'd then plug into the board, if you added a socket for it! Obviously leave the wire connection as an option for unmoded boards. I like the idea of adding the serial to USB to the board, maybe a china alternative device?
I just upgraded Arduino IDE to latest version 1.8.10 as of this writing. There are several changes related to available loaders for STM32 boards.
This is my working ST-Link solution. Works like charm on Linux and Windows. Important: First use the official board manager under File->Preferences
Url: "github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json".
Then download "STM32CubeProgrammer" from ST Microelectronics site. Now in Arduino IDE, under Tools->Uploads there are now seven different methods to chose from. I tested "STM32CubeProgrammer (SWD)" with an attached ST-Link V2 USB dongle to the Blue Pill board. It worked directly when I used it on Windows 7 (yes I know, it's old but it's very seldom used).
Debian (stretch) Linux is my primary development platform. Two small modifications is required, first install Oracle Java (jre) and make it the system default java, and then
add one udev-rule file in /etc/udev/rules.d to allow usblib and ST-Link root-access to usb devices. Add these lines in a file e.g 99-STLink.rules.
SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", MODE:="0666"
SUBSYSTEM=="usb_device", ATTRS{idVendor}=="0483", MODE:="0666"
Happy hacking
Without this rule you will get
-------------------------------------------------------------------
STM32CubeProgrammer v2.1.0
-------------------------------------------------------------------
libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/001/007: Permission denied
I'll be downloading the new Arduino IDE version asap then, thanks for the heads up.
Another quality video Ralph, thanks. I see a lot of people asking why you are still using Arduino IDE. The people that produce the cores (the software that allows programming an STM32 like an arduino) will tell you that the Arduino IDE is the "standard" IDE. That is what they support , not platformio or any other IDE. So really you are correct to be using the arduino IDE.
I fully realise, as you do Joey, that many of my viewers will only be using the Arduino IDE and just don't have the desire, experience or competence to move to a different IDE, after all this is a hobby for most of us. So whilst I may use other IDEs in my demos I always make sure it runs on the Arduino IDE. Next week's video proves this point very well! Don't miss it!
The STM32duino wiki has a description of the differences between the black, blue and red pill. In a nutshell, the black pill is cheaper with a fixed USB resistor and the LED on "better" PIN. The blue pill has more pins, breaks out the 5V and has a better regulator.
So the question remains, Stephen, why did they change the footprint? Why not keep it the same as the Blue Pill so an improved design could be a drop-in replacement? I don't see any incompatibility with your comparison of the two boards.
I can’t see any compelling reason for the footprint change. It’s the same problem as with some of the ESP8266 boards being a lot wider for no obvious reason - the LoLin boards come to mind, pretty much the same pins broken out etc. but totally un-breadboard friendly mega wide. I think it was arbitrary by whoever made that board initially.
@@RalphBacon Did you notice when you turned the black pill over that there isn't a single component soldered on the bottom? That's a critical difference. The cost of PCB assembly for a board with components on both sides is significantly more because you can't just flip the board over, do the paste application, pick and place components, and stick it into the reflow oven. Parts would fall off of the soldered side.
Because the black pill had to be physically larger to accommodate all components on the top size, it also allowed them to put mounting holes on the Black Pill. If you're going to use a pre-made STM32 board in your project that you intend to use for real, then one consideration should be how you're going to mount it. The Blue Pill has no mounting holes.
@@stompreaper Are you talking about the NodeMCU ESP8266 boards? That NodeMCU has an ESP-12 on it plus the breakout pins. That's primarily what constrains the board width. The ESP-12 is already FCC certified (has it stamped on the RF shield), as opposed to the ESP-01 which wouldn't pass certification because it lacks any RF shielding. The only width reduction you could do on the NodeMCU is the width of a single 2.54mm pin column and you would lose much of the top-side silkscreen labeling of the breakout pins doing so.
@Wavicle yes, probably the ESP-12 boards where there was a difference between a LoLin board and a real NodeMCU board. One was usable on a breadboard barely with 1 row of pins each side, the other was one row wider making it unusable on a breadboard on one side. You could make it work using two breadboards by removing one set and straddling the joining power rails. Didn’t see a great reason for the wider board given same chip - seemed arbitrary.
===================================
If you get that far in the video...
*Boards remaining: SORRY ALL GONE NOW!!!*
My email is in the About tab of my channel
===================================
Yes, all gone now.
Hi Ralph, Yesterday I tried the Bluepill modules I got working with the bootloader on a Mac which I have not used in some time so unlikely to have any special drivers running and it worked flawlessly. Which makes me think its about the device and not the PC. I am happy to post one of these to you to try out on your Windows Machines if it works then I think we will be able to come up with a working set of steps for your viewers without all the misinformation out there that wastes our time. I am happy to cover the postage and the modules are cheap as chips:)
It could indeed be the device. Here's my response to another viewer who suggest I use the USB Diag app:
Ralph S Bacon
• 15 hours ago
OK, I had a go. An interesting view on all the drivers I have installed!
It confirmed that the STM32 Blue Pills all have *VID=0000 and PID=0002* so probably no wonder Windows doesn't know what to do with this. This is on the genuine STM32F103 boards, by the way. However....
For the clone boards, with a CKS32 or even a genuine board but where I soldered a GD32F103 in place of the STM32 it comes up as a Maple Serial (COM14) if I flash the naze32_boot20.bin instead of the expected gd32f1_generic_boot20_pc13. All as reported in my video.
So the clones are all working just fine. The STM32F103 boards have to use my Programmer. It's not exactly onerous. But frustrating that the original Blue Pills are all enumerated as VID\0000 . Not to mention weird.
----
So, is it the actual chip? Is it a fake STM32 chip? I have no idea. I'll await your response. We may end up swapping modules at this rate!
@@RalphBacon Interesting they sound like nul values. If you would like me to send you one just let me know can give address via linkedin. I have the bootloader working on three types of dev boards now the only one that failed is ironically the mini maple which has D+ not Gnd soldered to the outside of the usb port:(
Let me send you one of mine, Andrew (I'm assuming you're UK-based) - if you get that working then we know it is me not the board. If it doesn't work then it's the (set of) boards I have? If you send me your address in an email (which you can find in the About tab of this channel) it will be winging its way to you.. Oh, I'll preload the bootloader that doesn't work for me but seems to be running (on chip) just fine.
Why not use the ST-LINK like in your first STM32 video? You don't need to change jumpers when you upload via ST-Link. You can create a custom cable for the connectors on the short side of the board. You can power the board via ST-Link if you want. You still have RX/TX available for other use, e.g. for a Bluetooth break-out board. It's only about 50 cent more expensive than a USB-to-Serial adapter. And best of all: if you use the free PlatformIO instead of the Arduino IDE, you can even debug your program on the device.
I still intend to use the ST-Link now that my replacements have arrived. The previous one died, for reasons unknown.
As for your other solution of using Platformio you will be pleased to know I already successfully use *Visual Studio Code* and *Platformio* for Arduino and ESP8266 boards (as Eclipse Arduino is not being continued) - I haven't shown it yet in my demos as I would a gazillion queries and I'm not experienced enough in it yet to talk knowledgeably about it. But I need to use it for my ESP32 course so I should become move conversant as time goes by.
Then I can use the ST-Link for debugging on the STM32F103 front too. So much to do, so little time to do it in!
Ralph S Bacon Cool. I’m looking forward to it.
I have a couple of blue pill boards I bought a couple years back. I don't know which resistors it has, but it works with my laptop. I got some autogenerated comm port code from stm32cubeide to transfer data. It's flakey though, if you reset or reflash the board, it stops working until you unplug and replug the cable. I think STLink is the way to go on flashing and debugging, though having the ftdi installed on the combo board would be handy. On a future revision you might want to bring the trace output line to the STLink connector pins. A lot of the cheap V2 boards should be able to capture trace message output through the debugger interface. I really like these boards, and being able to use the Arduino libraries is cool too. Or, just run freertos or embed I guess. These boards are so cool. Closest thing you can get to ultra low sleep power battery operation, without serious modding the board, but the power LED has to go. So many other dev boards have power sucking things all over them, like linear regulators.
It's my understanding that there are some black pill boards with M4 processors, f4xx or alternatively an l4xx I think. The f4xx is double the speed of the blue pill f103/ME and the f4xx have built in FPU, and some DSP instructions I believe.
I fried my STLINK (no idea how), replaced it (with two others) but they took so long to arrive (from China) that when they did I had moved on and they never got used. One day, one day.
Thanks for that video. Useful and interesting for me. I'd like to suggest using two reset buttons and e.g. an ATtiny85 to control boot0 and reset. At least that will be my approach when I create a clone of your board. Also I would use the pin-row for the FTDI upside-down so there is no need to cut them if you stick it on the board without socket.
Anyway, nice project. I totally agree on 'you just have to dive into it'. Same experience here.
I'm very happy you have decided to dive in and make your own PCB solution too, it seems many of us have on-going issues that never got resolved. Interesting about the ATTiny85 - how would it know you want to upload? By a single button that effectively says "Program" and it switches the boot0/1 automatically?
@@RalphBacon the middle one of the 3 pins get by the jumper either GND for start or 3.3v for flash. The ATtiny could set the right level on the middle pin depending on what button was pressed and then a bit later fire a reset pulse. It's a pity that pin44 is not available on the outer pin rows. Then even the cable could be removed. Maybe a pogo-pin from beneath can do the job.
Unlike the typical Arduino board, the blue/black pills have no dedicated USB-to-serial chip. Instead, the STM32F103C contains a USB interface that can - given the right firmware - turn the board into a USB device of any kind: keyboard, mass storage, serial etc. If in boot mode, the bootloader will need to be USB capable. If in run mode, the uploaded firmware (sketch in Arduino speak) will need to make use of the USB interface. Out of the box, the blue bill does neither. As a first step, compile and upload the _USBComposite for STM32F1_ / _simplekeyboard_ example. Then your blue pill becomes a USB keyboard and writes "hello world" every 10 seconds. You might need to set the CPU speed to 48MHz for it to work properly. If you want a USB capable bootloader (instead of the serial one you're currently using), other people have provides links in the comments.
This probably explains why I never had a problem programming my STM32. It likely came with a compliant boot loader. I'll have to look up where I bought mine.
@@newburypi That's possible. I've seen in the RobotDyn Store on Aliexpress, that you have to choose between "ST f-ware" and "Arduino" when you buy a black pill. The description says: "With original STM bootloader firmware (doc AN2606). Use USB-UART adapter for programming." and "With bootloader compatible for Arduino IDE. For programming from Ard. IDE using USB port." respectively.
I don't think any of my boards, cloned or otherwise, came with anything, they were dead as a dodo. I had to flash the bootloader and install drivers etc - which was fine for the clones,not the originals. And the GD32 chips were just bare chips so no surprise they needed to be flashed.
Ralph S Bacon Try the STM32 specific USB example sketches and your USB port might finally come to life...
Hi Ralph, great stuff once more, and I'm glad your enjoying Kicad more now, I tend to put copper pours top and bottom where possible, it's a small thing but it means less copper getting dissolved and ending up goodness no's where! you mentioned playing around with Visual Studio Code and Platformio, me too, if you like it, maybe a tutorial? that would be nice, just your thoughts and an overview. Also your right about the Nano! So this is a second bench top tool you've designed, it's a great idea to use the FTDI in this manner, it's the same board I and may others use even after "FTDIgate" I was never caught out by that (thankfully) I don't hear Fritzing mentioned much any more I think EasyEDA impacted that. I look forward to you finding out what this USB gremlin that is tormenting you is all about...good luck!
Hey, Andy, good to see you there. Yes, that was partly my reason for the ground plane and the ease of connecting up a fairly common net.
I'm in the early days of VS & Platformio but the support seems good. And the fact that so many users are having great success without constant tinkering probably it means that it has matured enough for relative newcomers to the Arduino world. A tutorial, you say? One day, one day!
Also, one day, I will crack this USB problem but for now this PCB/FTDI solution is just great, though I say myself. I don't want to waste any more time on it! But apparently I have a cloned FTDI board, as the official FT232RL chip is at least $2.38 even at high volumes. Oh well, it's not bricked itself just yet...
Thanks for posting, see you around.
I have found compile/download times very long in pio for my stm32 nucleo board (> 16 seconds). Using Atollic TrueStudio download and launching debugger is a few seconds. I have not tried debugging in PIO. Also found it a little difficult to find where everything is if something goes south.
A quick comment on the board you designed. Maybe make if longer i.e. line up the two boards the long way so you can get to the break out pins more easily and have some holes around the outside so you can solder on male pins that plug into a solderless bread board (no signals, just for mechanical) and a barrel plug for a external power supply.
I thought about the shape of the board before I made it, Joey. I had them side by side, on top of one another, at right angles... eventually I lined up the USB sockets best I could and thought: that at least looks OK. I'm going to solder the FTDI flush with the PCB as best as it will fit and see if that helps too. But V2 may take your suggestion on board, you never know!
FYI, you can burn a bootloader on the blue pill, so you won't have to mess with the jumpers (you can solder them together). It's pretty easy to do; there is a guide here on RUclips about it.
EDIT: also, when you use the bootloader utility, it will show you exactly how much actual flash space you really have. On these generic boards from ebay/Amazon that come from India or China, it will allow you to pick the 128kb option in Arduino IDE, but the bootloader utility will show you that you've only got 64kb's to work with.
I've tried many times (and failed the same) for the _original_ STM32F103 chips. Funnily enough, the clone boards, both STM32 ad GD32 work just fine with a bootloader. Odd, huh?
@@RalphBacon That is strange. Up here in Alaska, due to the shipping, I go for the clones with the economy shipping. I think occasionally the Chinese find a better way to make stuff with their frugality, when they go about "borrowing" everyone's technology. I'm too poor to complain, really. The clones work, so I'm happy :D
Hi Ralph - A nice idea suddenly thought about 40 pin ZIF socket instead of the female header blocks so started a PCB design. The FTDI will mount upside down using just male headers to keep the profile low enough to use a cheap plastic case 100X60mm. Two tactile switches and LED's - through-hole and will see what else can put in.
You're another one thinking outside the box, Michael. I just wonder if the square header pins are too chunky for a ZIF socket? If not then maybe you will see your suggestion when I next show this board off! All good suggestions. Excellent!
@@RalphBacon Good point! Just checked with standard male headers and the only ZIF socket have here (28pin) all fine. You are welcome to a free board and ZIF when I get these. Will work out your address details later on. Again thank-you for the idea.
Bad news on this front, for me, Michael. Why bad? Let me explain.
I have a spare 40-pin ZIF socket (left over from my PIC programming days, I _knew_ it would come in useful one day). That means I must now solder up a new board with a ZIF socket, the FTDI (clone) board directly on the PCB (no header sockets), solder the LEDs where the resistors are (and vice versa) and then kaboom! I will have a pretty nifty programming board. The bad news is that you have made it essential for me to do this, as if I haven't got enough to do already!!!
BTW I can't mount the FTDI board upside down because it has a 5v/3v3 jumper on top. I suppose I _could_ remove that and hardwire it to the correct voltage... we'll see.
I'll be interested in seeing your board - it may appear in a future video!
@@RalphBacon Not at home at present to check the more physical connections - I used best guess for FTDI fit sat upside down. Sure have some FTDI boards with low profile 3V3 or 5V switches. The profile is key as only have 25mm to play with in terms of depth if want to fit in an actual easily available project case. With you on all these matters - is about thinking ahead for issues. That is why your RUclips channel is interesting and then can make us think - we can all sit and develop and have work published for our own arena of hobby electronics. Make things is the total key.... I've seen you come from first starts in PCB design to actually using a different package away from vendor tools (no slight as still great) For my sins I use Diptrace I feel is no evil in using the tools that you feel most comfortable with. As part of education will also look at Kicad. The people who sit and debate what is better, seldom do "Anything at all" We are here to make and ask for help when need that second opinion. So has to be projects no matter what that actually is. Some disaster could be forthcoming but every board is hackable and that is the education element. Been there and done that. One bodge wire and cut trace and works like a champion. That was for a control dongle that held 5 X PCF8574 devices alongside an ESP8266 for a reasonably custom project. Really we need to make things.
Then will see mistakes made, which will lead you on to thinking could "I route that better" often for me the answer turns out to be "Yes" Then can go into a tailspin seeking utter perfection and forgetting to order the boards and actually making something. PCB Design seems to be a whole new hobby to me.
I'm with you, MIchael, on the "whole new PCB hobby". This board, if very slightly revised, could easily be sold on a website as a professional item for £4.99 or as a complete kit of parts for £9.99. PCBs have that effect! Pity I'm not into that arena, but someone may decide to do it, or something like it.
Thanks for your interesting post, totally agree with the "just do it" attitude (pity B&Q already snatched that mantra) to get something viable and concrete in your hands.
Another Great Video. Thanks for the idea if I have do it myself. I've been using an alternate fab house but now seriously thinking of switching. I suspect this has been answered somewhere in your blogs or videos but I missed it. Are you selling the board?
I'm not selling the board (I should have done) but the PCB project is on my GitHub (I believe) so you can just download it, tweak it as you see fit and order the board. Let me know if you have issues finding it.
The blue pill or black pill or any stm32f103 does not come preloaded with a USB capable boot loader. In order to program using USB you need to flash a new bootloader with this capability. A nice video instruction with links to the relevant software is here (ruclips.net/video/wGbiT6IxGP0/видео.html ) by Caleb Marting. Written instructions are here (github.com/rogerclarkmelbourne/STM32duino-bootloader ) by Roger Clarck.
I probably know Roger's website by heart by now, Uzi, I've read it so many times! Not that it helped me so far except to get the clones working which is at least some progress. I'll revisit all this some time later this year. Right now I've had enough of all this. But thanks for posting, nice to hear from you.
Ralph: As there are only 4 surface mount devices, could you make available a through hole version of this board available? Maybe with a smaller momentary reset switch too? I am only at 6:32 in the video right now, but am enjoying it like all of your well made videos.
A THT board would be a doddle to make (he said, glowing in his new-found expertise at PCB design). You can either take my design (on the GitHub) or I can put a new version up there in a day or two. Let me know, Bruce!
The ftdi issue wasn't a firmware update but a driver. That bricked any ftdi clone chip. Unfortunately the biggest hit were not builders and hobbyists but end consumers who purchased accessories that used an ftdi chip, ie keyboards flash drives etc, that were bricked. The fix is to rewrite the manufacture code to the chip and it takes a working knowledge of drivers and how they work within the os to do that along with multiple ftdi utilities. My wife had a brand new mouse and keyboard very bricked because clone chips got into the supply chain. Took almost an hour to get them fixed.
Sorry for the block of text, just wanted to let you know a bit of the more technical side of that.
Great video as always, I hope you keep it up.
And the ftdi issue, last point, was acknowledged by ftdi and their response shone a very bad light on the company to be honest.
When I edited my video I realised that I had said both 'driver' and 'firmware' - and then I was unsure what had bricked it.
Now I know, so thanks for clarifying, Dragon Kin. It was a stupid thing for FTDI to do, that for sure - they never punished the manufacturers using cloned chips; in fact, the board manufacturers might not even have known they were using cloned chips if it said FTDI on the front (which it did, apparently). It was always the end user who was going to get severely inconvenienced.
Glad to see your technical expertise sorted out your wife's keyboard and mouse!
@@RalphBacon Technically it was a combination of both, since the driver changed a setting in the chip's eeprom - changing the PID value from 0x6001 to 0x0000. This was easily fixed on a Linux computer with a command line utility that allowed you to reset the PID back to the correct 0x6001 value. I do believe such a utility was also made for Windows machines. The issue never actually affected Linux users since the driver is a kernel module on those machines and not "officially" from the manufacturer so no bricking could occur. Yay for open source. ;)
Nice video & very nice board design, Ralph.
May I ask if you've tried using an STLINK v2 yet? I've found it to be a simple, economical (~$2), no fuss, plug-n'-play programming solution (no moving of jumpers, no pressing reset).
Cheerful regards...
I've used it a couple of times (before it blew up) just to upload a program. Worked fine. Never tested whether I could get serial data (eg debugging statements) back into the Serial Monitor. But I have replacements now so I can continue my testing.
Did you pay the extra to have pcbway omit their part number, or did you omit to show it? Cheers, I like your down to earth approach. Btw, designspark PCB from rs components does 3d very well to + you can export to designspark mechanical to make printing housings a breeze. No prizes for guessing which I use!
The order number is on that board somewhere, but it usually very small and "under" a component if they can fit it in. I don't know hwy people want to hide it but I'm not going to pay for the privilege either! I shall check out DesignSpark and see how it compares, thanks for the heads up!
VS+PlatformIO, I would like to see how to properly setup for any device.
Internet is full of tutorials for ESP32 and Arduino but not for Sipeed Maix-GO RISC-V Dual Core 64bit or some other cheap extremly powerful chips out there.
Maybe you can make some tutorial on that chip in that programming environment, mycropython seems pretty easy for nubies like me :)
Thanks for sharing.
Hmm, the trouble is that there is _always_ another chip that hasn't been covered yet (or properly). I'll have a look at it, see hat it's got that others haven't. Thanks for posting.
@@RalphBacon That is absolute true :) I meant how to manualy add, so 1 way for any chip?
I'll add it to my list of things to look at, Jedan, keep tuned!
@@RalphBacon Thank you, I will stay tuned anyway :) love this channel.
10:40 I prefer to take control of optimization by using the "inline" compiler directive just for those functions which need to be fast.
Indeed, Peter, I've used it lately to prevent the compiler "optimizing" it, a bit difficult to know how much of an improvement it brings. Does not one of the compiler "o" options also prevent functions being called umpteen times rather than being inlined?
@@RalphBacon That is a problem. You don't know what the compiler is doing unless you use verbose compiler logging and most IDEs do their best to hide what they're doing.
FTDI were a real pain as it was an update to their driver that 'bricked' the clone chips, and I got stung when it tried to brick a chip on a device, and had to go through the process of 'unbricking' it by resetting the magic flag the driver was setting on the chip. Just a thought... Does the STM32 actually need the boot pin held in the alternate state the whole time for programming... Or is it only checked on reset? If so, you could do two momentary buttons - press 'n hold 'prog', hit reset, then release 'prog'... Just like the ESP8266, etc...
In the interests of science, Peter, I just tried out what you asked (about Reset/Prog) etc.
You MUST move the jumper to the PROG position, press RESET, wait for the upload to start and THEN you can flip the switch back to RUN. The upload continues. But I still had to press RESET again for the genuine STM32 to start running - not so on the clone CKS32 nor the GD32 which started running immediately the program had uploaded, even with the switch still in the PROG position.
That all said it was much more fiddly to do it this way. It was easier (especially with the clones) to flip it to PROG, hit RESET and then upload. Momentary switches like you have on the ESP8266 are the bane of my life and now I only buy TTGO versions which seem to not require any button presses, they just upload and run via the USB, just like the Arduino.
Another successful experiment concluded. You're welcome!
@@RalphBacon Thanks for trying out my random thoughts ;) I just tried it myself, and with a sample size of 1 (overwhelming, I know!) and following this process, it was successful, using serial upload via PA9/10 and the Arduino IDE, with an older and AFAIK genuine STM32 F103C8: 1) move boot0 to center/1 position 2) press reset 3) move boot0 back to 0/center position 4) hit upload on the Arduino IDE 5) stm32 self reset, so program started doing the blinky blink dance. I'll try with another board in the morning to see if it behaves the same. I just thought it *should* work this way since these are the *boot* mode indicators, so if it needs to be on longer than, well, booting, it's just being difficult. And I hear you on the ESP8266 reset button dance... it was really bad when the manufacturers used those midget SMD buttons... I use the more human sized tactile buttons, and it's much easier... but a DTR auto reset circuit is so much nicer, especially when uploading code multiple times in a short period of time! :D :D
If you don't want to change that jumper then use st-link. Also st-link give better debug option.
@@LimbaZero Yeah, st-link is certainly the best option, especially for the debugger :) At least that or just plain serial is more reliable than dfu. What is more annoying is that dfu appears to be mostly working fine on Windows, but there are more than a few reports of late of it not working at all on linux, which I can also reproduce.
Hi Ralph. Thanks for explaining the physical differences between the blue and black pills! Interesting video. The STM32 is starting to look like a Nano replacement based on your videos. That is until you try to do anything other than turn LEDs on and off. Reference the NRF24L01 difficulties, thankfully now resolved. That said, sketches that work perfectly on the Nano do not just run on the STM32 without a lot of head scratching., especially where the SPI bus is concerned. Take TFT displays (and I hope you will in a future video) I just cannot get them to work on the STM32 SPI bus. What seems to me conflicting information on the web doesn't help. I'm looking to use an ST7735 1.8 inch TFT display on the STM32 for a project but am struggling. Any thoughts would be welcome.
I still have it on my list to try, Paul: STM32F103 and TFT (I2C), SD Card (SPI), nRF24L01+ and another display I have that uses the SPI bus in some strange way. It *should* just work, but as we have discovered nothing is ever that easy or else I would not have needed to have build this PCB - I'd be using the USB socket!
@@RalphBacon Hi Ralph. I'd not bother with I2C for the displays as most of the Chinese OLEDs and TFTs today are SPI with many having an SD card reader too. I've read that hardware SPI is much faster. This a.m. I have got a 1.8 inch 128 x 160 TFT working on an ESP8266 using the excellent configurable "Mr Bodmer TFT_eSPI library" (Github) which does work very well and I would recommend it. I've tried it on two different SPI displays (ST7735 & ST7789) with complete success. Still cannot get it working with the STM32 though. I'm trying not to feel smug that my STM32s work fine on the USB port. All the best
I feel your smugness from here, Paul 😡 but you are forgiven because of the other useful information in your post!
Hi Ralph. Thanks again for the video, excellent as always.
I’ve still not tried the Blue Pill, it’s in my ‘to do’ pile of stuff as I’ve not had much arduino time recently.
Maybe this is due to me being a nosey sod ha but have you ever considered doing a background video, as in your working history etc as you seem very knowledgable and I assume you’ve worked in the electronic/electrical industry for a while? I may be wrong there and yes, I’m nosey.
Did they call you Pinocchio at school? Ha ha, no you're not being nosey, you're interested in my background which I tend not to go on about. I won't be doing a video on it , though. I'm a software engineer by profession and have been doing electronics since I was about 14. I even had a couple of digital circuits published in a UK electronics magazine (for which they paid me £40 each, and that was back in about 1985, so probably £100 today. I saved those magazine for decades but now they are lost :(
Ralph S Bacon haha something to that affect or effect, whichever one it is!
Good to know, I thought you must work in the industry as this is a vast subject to learn. Good to know, thank you for sharing. A real shame regarding those magazines, they’d be good to see. I’m assuming you cant get back issues still, digital or otherwise as most magazines have folded (no pun intended). Or at least I’ve not found any in the shops, other than for Pi stuff.
Did you configure the boot jumpers for usb operation?
But yes, its not very stable. Using the SWD thing works way better.
My programmer PCB does this boot jumper nonsense via a little slide switch, soooo much easier. But since this video I have received two further STM32 devices - both ORIGINAL and work as you might expect, just like a Nano.
Sir...Can you kindly give a full tutorials on using KICAD for schematic and pcb design
There are plenty of tutorials out there, Adeshia, you don't need me to show you this, really you don't.
If you use ST-LINK, you don't have to fiddle with jumpers.
And if I use my STM32 programming PCB I don't have to fiddle with jumpers either! But I must find out more about ST-LINK, I have three of them (blew one up) for debugging.
15:11 flakey USB cable. I find the most reliable cables are the big fat translucent blue ones from China - also fully screened.
I need to get a new set of USB cables, Peter, so I'll have a look for the "big fat translucent" ones from China!
Don't worry about saying "kosher". At least in the US, it means the same thing as it does in the UK: good, proper, etc.
Good to know, thanks for the info.
@@RalphBacon I can still remember my sixth-grade teacher explaining that it was a (yiddish?) word meaning "clean".
This is a Brilliant Idea !
Works well, and makes start up faster too!
Why didn't you use the ftdi reset to put the bootloader into flash mode? If you're going to design a board...
Sounds like a good suggestion, didn't know I could do this.
Can you just swap the LED and current limiting resistors to move them into a more visible area of the board?
Bob, oh, Bob, soooo late to the party! Where have you been, I've missed you!
So this was already suggested many days ago and guess what? I've already built a new board with that change, *plus* soldered the FTDI directly to the board, and I've used a 40-pin ZIF socket for the STM32. All as a result of suggestions received here. Look at this:
Here's a pic: www.dropbox.com/s/qno1c1bi7pe6gbq/V2%20Snapshot%20Hi%20Res.jpg?dl=0
Forgive my tongue in cheek intro, you know me well enough that it's all in good spirits and you're on the same page as others here, that's for sure. Thanks for posting, good to hear from you.
@@RalphBacon bugger, too late to grab the glory again ;)
...hey Ralph did you notice on Banggood they have a pyboard clone that comes with micropython preinstalled for around $10, it uses an stm32 chip like the one you're discussing in the last few videos, it has an accelerometer, four differently coloured LEDs, sd card slot, a user button and is detected as a usb storage device so no need for programmers etc. It's fantastic and amazing all in one, check them out you'll get a kick out of it even if you don't want to move to micropython yet, thanks for the video :)
I didn't notice but you mean this one here, I guess:
www.banggood.com/search/pyboard.html?p=FQ040729393382015118&
Looks quite interesting, although the chip is not an F103 it's a F405. I shall investigate, thanks!
..yeah that's the board alright, 50x50 mm so not the most compact but incredibly easy to program, there's a micropython editor available called Mu, has code completion even, beats the hell out of Arduino but I suppose it's good to have choices as well so...
So many boards, so little time...
You need to flash a usb boot driver on to the STM32 board. It will take some of your available flash but it is this that talks to your computer. Without this it will not work.
Indeed. I found that the newer bootloader just didn't work on this "fake" STM32 but an older one did. I've posted it about it here somewhere.
@@RalphBacon Hi, Is there any solution for an OTA firmware update on STM8S?, Thanks in advance. 🙂
@@junaidahmed4357 I believe you would have to do that like any other "non-wifi" OTA. By using an ESP32 as a programmer.
hey Ralph I have a lidar module with the bluepill cpu embedded in it. there is a breakout cable that supports spi I believe but how should I attack this. scope it first? I got a new scope last week hehe
when the module is powered up it just goes to work. I control the speed with another pin for 0-5 volts. for the motor. I'm thinkinking I should just see what data it spits out while stationary then parse it
If it's SPI then one of the pins will go LOW when the SPI is active; then you can read the data using a cheap logic analyser (see video #99 ruclips.net/video/7_gCUZg8nAo/видео.html ) and you will be able to read the data on your PC (with a bit of practice).
@@RalphBacon I can read hex like English. Every thing except ascii haha. I figured out the issue however which is good
For that USB problem. Did you verify that R10 is 1.5kOhm
The resistor on the board is 10K but I put a 1.8K in parallel to make it 1.5K - didn't help and many others have told me that their boards have a 10K (or 4k7) and it's recognised by their PC just fine!
Have you managed to run the wdi-simple.exe and the install drivers exe? If you haven't heard if these before I can give instructions.
Yes, I've done all that, several times, uninstalled, reinstalled, flashed bootloaders (successfully) but all to no avail. It's bound to be something really, really stupid that I will discover one day. Until that day...
Hi, Is there any solution for an OTA firmware update on STM8S?, Thanks in advance. 🙂
You need Wi-Fi and a Web Server running on the target device to use OTA.
The lack of USB UART bootloader annoyed the hell out of me. Right up until 2 things "clicked" and the bell went off with an "Ahhhhh....."
The STM32F1 is more than capable of running the USB port itself. No need for UART chip. However using that functionality with a USB UART bootloader would waste one of the advantages of the board design. Using the USB port as a USB port in your project. Such as for USB audio, USB Virtual COM port or any other device class really.
The second thing was buying a £2.99 STLink clone. I will never go back to USB programming if I can avoid it. I immediately went out and bought a programming hardness for the ESP32 modules which exposes the correct JTAG programming/debugger pins and bought an ESPProg.
Having live assembly and core register access with breakpoint bring this MCU tinkering hobby right up to my normal day job level of tooling.
My first STM32 was a Nucleo64 board. It came out of the box with UART2 connected to a VCom port multi-enumerated as both STLink + VCOM8. Anything you printed to UART2 came out over the USB port. I then mimiced this in my projects on the Blue/Black pill boards. I create a VCOM port for debug output and use the USB port for that.
An interesting and highly useful BlackPill project is to wire up 2 or 3 or 4 UARTs and multiplex them onto a single line by line VCOM port output.
Then you can hook all the RX lines up to strategic points in your setup to watch both sides Tx and Rx between devices. A UART "tap" for debug purposes. Very, very handy when trying to debug a bi-directional protocol like AT Command set for example.
Uploading using the ICSP method works best for me.
Just use the STLINK and forget about all the hassle with jumpers, resets, USB bootloaders aso. It is really not worth the effort unless you have a very good reason to not use an STLINK. The pins that the STLINK uses are only used for that purpose (or general IO). They don't interfere with any of the other peripherals (UARTs, I2C, SPI, ADCs, PWM). Considering an FTDI costs more than an STLINK dongle (unless there's some kind of promotion) and you can actually do hardware debugging with the STLINK, this is a no-contest.
The only caveat: I recently received STLINK dongles that are based on STM32 clone chips and not longer on actual STM32s. They work for now (didn't use them as debugger yet though), but who knows if future firmwares will work on those dongles. So if you care about that (you can install completely different firmware on the STM32 based STLINK dongles, like black magic probe, which might not work on the clones) either make sure by asking the seller that you get an STM32 based one or use a blue pill as programmer instead.
Yes, I fully intend to explore the ST-LINK v2, it's just that time is of the essence! And my ST-LINK blew up. Not literally, I just got (yet another) USB Device Not Recognised message. The replacements have arrived and they are fine, so I can continue exploring. Another viewer mentioned turning a Blue Pill into a Black Magic probe - I'll check and see what chip is actually inside this ST-LINKs, thanks for the warning.
These clones work for me as debugger with CooCox CoIDE, just need to update the firmware once and you are good
I'll check it out, thanks for the heads up.
ST-LINK does not support serial output and I have never done a project that didn't require me to do some basic debugging. If you have to wire it up to debug you might as well program it that way also.
@Andrew Toogood That was my thinking, for now at least, until I get to grips with other methods.
That is the difference between Production and Debugger version of the Hex code.
We once released into production the development version of the code and wondered why it was appallingly slow. It also displayed detailed error message about our hardware etc. Oops.
When Windows USB has problems, try USBDeview from NirSoft to uninstall any USB device _including disconnected ones._ You can have hundreds to thousands of inactive USB drivers and that can cause conflicts to install a new device. www.nirsoft.net/utils/usb_devices_view.html (Just Unzip to a Folder, No installation needed.) To add USB IDs... In USBDeview Window, Click USB.ids at bottom will open a browser, save page as text and put in USBDeview folder then restart USBDeview. Note that it is easy to uninstall keyboard or mouse extra function drivers because not all shows as active but unplug then plug in their USB again should fix them.
I shall have a look at that, for sure, any port in a storm (pun absolutely intended)!
OK, I had a go. An interesting view on all the drivers I have installed!
It confirmed that the STM32 Blue Pills all have VID=0000 and PID=0002 so probably no wonder Windows doesn't know what to do with this. This is on the genuine STM32F103 boards, by the way. However....
For the clone boards, with a CKS32 or even a genuine board but where I soldered a GD32F103 in place of the STM32 it comes up as a Maple Serial (COM14) *if I flash the naze32_boot20.bin* instead of the expected gd32f1_generic_boot20_pc13. All as reported in my video.
So the clones are all working just fine. The STM32F103 boards have to use my Programmer. It's not exactly onerous. But frustrating that the original Blue Pills are all enumerated as VID\0000 . Not to mention weird.
@@RalphBacon Blue Pill USB is programmed "wrong" when made and likely never work in other OS' too. In general terms USB ID is a "low level" function in the firmware for a given device. Far lower then a boot loader, media format and so on you can write later.
Or was reprogram by a USB Driver similar results to FDDI did for clones and brick them a few years ago.
Or other problems w/ your chip.
A Guess is some chips has USB VID and maybe PID as default values for a Bulk Buyer, other then maker of that product, to program later for their own devices and setting them may not be easy for several reasons or software for this is not generally available.
USBDeview is nice and small. While you can manage USB in other ways like Win Device Manager this tool besides showing so much info in one place, allows bulk selection to disable or uninstall USB drivers fast.
22:31 "FTDI's are cheap". That's not true. The FT232RL IC is one of the more expensive USB to serial ICs out there compared to its alternatives.
Hi, I just bought 2 for £1.28 each, from aliexpress, maybe an offer but that really is cheap. "get em while they're hot!"
Yes, they are cheap especially when on offer(ie most of the time), I bought 3 for less than a cup of Starbucks' coffee!
You probably have a fake FTDI chip. FT232RL is $4.50 on Digikey, compare this to the CP2102 which is $1.40 and you will understand that FTDI chips are really expensive. There is almost no way to get two FT232RLs for under two dollars.
But it says FTDI on the chip! Ha ha! Well, may be not so funny. If it _is_ a fake chip (still, what, again?) at least FTDI won't brick it for me as they have stated they won't do that any more.
And you are probably right. Even on LCSC.com they are priced at $3.2409 each. Even if you buy 12,000 of them they are still $2.38 each. So I've got a fake FTDI board. Well, lots of them. Drat. That's the Chinese warehouses for you.
Chinese manufacturers and sellers can be merciless. I've bought for example an ATtiny85 a couple years ago from a chinese wholesale. The plastic housing of the IC got even ATtiny85 written on it, but after hooking it up it got the device signature of an ATtiny13!
Nice one sir
Glad you liked it, Yogesh, always good to hear from you.
...that red button is so big you could put a sticker on it that says 'reset', you might even get your name on it as well and maybe a logo and ....and....
Actually, JimBob, I was going to put on it either DON'T PANIC or DO NOT PRESS with maybe a couple of warning gifs, what do you think? 😜
..well yes for a start you could do that, you might get the pinout diagram for the bluepill on as well maybe, just a suggestion 😳
Excellent! And perhaps squeeze in a complete STM32 Data Sheet too? Sounds great! I've watched Mission Impossible, they can do all this so why can't I?
Ralph S Bacon ...ah you're taking the joke too far now....
You think? 🤔 Yes, you're probably right, you'd only get a summary data sheet on there, not the whole thing. Silly me. 😃
Since USB is directly connected to MPU IO lines you need a usb boot loader installed. It doesnt come with this....
Yup, did that, loaded the bootloader successfully, then - USB device not recognised. Again. Maybe I should try all this in my Debian Virtual Machine (Oracle Virtual Box)?
@@RalphBacon Woohoo! Ralph is coming over to the dark side... :-) Debian is what I'm running here at the moment, with a Slackware virtual machine to handle my email. And a Slackware file server over there--->
You could autimatically switch ton program mode whem DTR os teiggered...
Yes, I could have made this PCB much more sophisticated. It's called Version 2, Alejandro! Thanks for the suggestion, good to hear from you.
Hi Ralph, do you have a catalog of you RUclips videos?
Not exactly, MIchael, but you can download this pdf file which has the RUclips thumbnails and which are all clickable (unless the video is not public, so no sneaky looks at this week's video, sorry!) Get it whilst it is there:
www.dropbox.com/s/kcnap17npngp3tt/Ralph%20S%20Bacon%20-%20RUclips%20Aug%202019.pdf?dl=0
If this is not what you meant, please do explain further!
Ralph S Bacon Thanks Ralph. I’ve actually created a list of all your videos sorted by number with associated topic as per thumbnails in Word.docx format. I go back and forth between various videos so much that I wanted to have a list of the subject matter. That way I can find info as I need it. Is there somewhere I can send it?
I could post it on my GitHub and have a link to it on every video description. Who is going to keep it up to date? (Hint: not me!) If you find my email address in the About tab of this channel and send it to me I will upload it (and update it if you send me updates now and again). Any good?
Ralph S Bacon Hi Ralph,
I’m happy to update it. I’ll just send you a new word docx at the end of every month with that months videos updated. As a word doc it will remain editable for anyone who has a need for it. Let me know if you want/need any special formatting or additional information included.
No email in the about page. Here’s a link for you to access the file. 1drv.ms/w/s!Ahg7GEVUP0HfgtFiu2VsbM2mElr70w FILE EDItABLE
Coming late to the party................... please advise on the slide switch - it appears to be DPDT ?
Yes, it's is indeed a DPDT, one pole switches the LEDs from green to red, the other pole puts it in programming mode. Stops all the pesky jumper nonsense!
I have a hand full of blue pills working on 3 different computers all with bootloader and usb connection works exactly like a normal arduino i could do a rough video if you like
Hi Scott, I would love to see a video, especially one employing or using a SD micro card reader. I’ve bought several STM32Fxxx and find it hard to justify staying with the Arduino Nano, my previous favorite. I’m presently stuck with the Arduino IDE because I know it reasonably well and have a ton of projects I’m doing with it. Jumping to the STM32Fxxx is a natural, especially since I can use the Arduino IDE without jumping ship to a new IDE which would be another learning curve hurtle for me. Maybe down the road I’ll tackle a new IDE. Using the STM23F103 ram memory would be a great thing to see as well. Respectfully, Steve
I have now, too, Scott. Guess what? My so-called STM32s were FAKES! My new, genuine ones got the new bootloader loaded up by me and then connected to the USB just like an Arduino. All done in about 2 minutes. All that aggravations I had, thinking it was something I had done (or not done). Unbelievable!
@@gskempe9 I have no experience with micro sd cards Steve but can can show you how to set up a blue pill to work like a normal arduino
Hello Scott, great offer and thanks. Maybe I can return some info because I am doing a lot with the Blue Pill but there a lot of things I can’t do as well. Rather than use the Blog for information exchange would you consider emailing me directly to start an exchange, contact_9@aurorasky.net. Thanks again and respectfully, Steve
@@RalphBacon you should do a follow up video with uploading a bootloader. google blue pill duino guide. There are bin files to try including the GD MCUs. Also, MBED has a guide on it allowing for drag and drop programming using a nucleo board from ST. Potentially you can do this with a 2 dollar ST-Link knockoff? Good video.
For testers usb serial bootloader is best bet.
The FTDI module gives you exactly the same facilities as the bootloader (Serial.print messages etc), PLUS you get extra memory for the sketch because there is no bootloader present! So I'm not sorry about it not working, I'm just a little bemused and frustrated!
Can you not just swap the LEDs with their respective current limiting resistors. That should give a little more visibility.
At this price I think I would do a revision 2!
I could do a revision 2 but I think I can get that red LED movedover just a tad (1-2mm) without a board mod, and I will tone down the green LED too with a larger resistor. I think it will be OK. Better than OK!
Black pill has less noise. Better engineering.
If you say so, I don't have a Black Pill (hard to find these days) to compare against.
I do not have ST chips but this might help.
If the chip is not locked at chip or blue pill manufacturing time then USB port could be programmable using STM32Cube software to be a HID or other device types to try to fix invalid VID and PID. www.emcu.it/STM32_USB/STM32_USB.pdf on ST development boards and www.st.com/en/ecosystems/stm32cube.html
I've wanted to look at the STM32Cube so thanks for the information, appreciated.
I and others have mentioned Fritzing in the past and wondered why you prefer kicad, which seems to me far more involved, tedious, and unnecessarily complicated. I've never noticed a response from you (although as I watch so many of your videos, I can never remember which ones I comment on to go back and check). What are your thoughts on Fritzing?
Basically, Andy, I learned EasyEDA first, and found it gloriously intuitive. I was going to stop there. Then I was informed that it was 'owned' a particular PCB fab (who knew?), so I could hardly use it (with its subtle but ever-present advertising) when being sponsored by other fabs, could I? (Rhetorical, no, I could not, that was made clear).
So I learned to use KiCAD, which I hated at first, but I bought an excellent book and ploughed through most lessons. I now know enough to design stuff with it, but I still don't find it as naturally intuitive as EasyEDA, but I'm getting much more familiar with it. It's fine. I no longer think of it as "tedious and unnecessarily complicated". I'm a convert!
Then you (possibly) suggested Fritzing! Now I just loath those breadboard layouts you can draw with, I just do. they look so clunky, IMHO. That put me off. And I read this: hackaday.com/2016/10/11/creating-a-pcb-in-everything-friends-dont-let-friends-use-fritzing/ which I appreciate is a personal opinion of the author but I just didn't want to learn a 3rd way of creating PCBs - especially when those designs are a bit limited (or _can_ be limiting - I mean, what would I have done to get my 4-layer PCB if I had started in Fritzing)?
So that's it, really. No doubt if I had _started_ with Fritzing it would be a different matter. But, as it stands, I have other things to learn (like Visual Studio Code with Platformio) and there are only 29 hours in a day. Sorry, I _need_ 29 hours in a day to do all this stuff but I'm limited to 24!
I hope this fully answers your answer, Andy, and apologies for not really addressing your previous comment on Fritzing. If I do ever get a few hours free I might dabble with it and see if that article holds water - I never trust anyone with an opinion!
@@RalphBacon I did not like the fact that any schematic / pcb can be had by "the owners" on easyeda. What if I come up with a great invention and they steal it : )
@@RalphBacon thanks for the complete answer. I understand about using your sponsor's program. As for you giving Fritzing a go should you ever find hour 25, perhaps I'd now advise against it. Forget the breadboard bit - that is cheesy - but the schematic and pcb bits are so easy, you'll might fall out of love with Kicad. And you've clearly worked so hard to fall in love with it in the first place, that would be a shame. Keep up the good work. I always enjoy your stuff.
@@RalphBacon I've just read the article you linked to and frankly I'm angry. The 'expert' got so much wrong in his eagerness to ridicule the program, grumbling about what you can't do, which in most cases you can and very easily, that I can only assume he has based his opinion on the excuses of his students rather than seriously giving it a try for himself. Yes the parts editor is hopeless, but as for the rest I'm giving him a C-.
great channel ! Try JLCPCB :)
Ha! I'll take that comment as a humorous one, if slightly tongue in cheek!
@@RalphBacon No no ... I liked this channel very much and immediately subscribed.
At jlcpcb.com they will make a 100x100 mm double sided PCB, 10 pieces for $ 2. I have ordered all PCBs for them. You can see them here easyeda.com/wegi1
As for your PCB - I'm not an expert, but there is a lot of space, tracks are about 10 mils - they are sometimes thinner than on a red PCB - as I saw in this movie. I would give a path of 30 mils. Also ... The time-critical pin (TXD) is routed not the shortest path. It has a thin path and has one 90-degree turn. I say this after a few years of my own experience with PCB design. I did much worse myself :)
More or less good reason to try easyeda.com and JLCPCB. Or even for ... a black pill :)
At easyeda, there may not be such an excellent 3d preview, but you can design a PCB in half an hour and automatically transfer it to the implementation at JLCPCB. Thousands, thousands of components and libraries. The LCSC wholesaler also provides footprints for the parts it sells. Many words - it is faster to try than describe it. Greetings.
edit:
ups changed - now first 5 PCB for $2, 10 for $5
LOL I found this
github.com/RalphBacon/EasyEDA-Documents
@RSB please forgive me
The USB doesn't work on the blue pill with the Arduino IDE by default, use this doc www.techshopbd.com/uploads/product_document/STM32bluepillarduinoguide(1).pdf and you can forget all the serial hassle in the youtube :) and just download your code via a micro USB as per usual ...
It's good of you to supply that link, Gary, but I have tried everything on that document. I've now shipped off the device to my technical consultant some several thousand miles away (yes, really) who will check whether the device I have behaves like all the ones he has successfully flashed and got working. I'm waiting with bated breath...
@@RalphBacon Very Frustrating, I'm sure !! I'll try over the weekend and see if I have the same experience ... Let you know !! Thank You for all the great RUclipss !!
@@RalphBacon Going to give this link a try ... ruclips.net/video/wGbiT6IxGP0/видео.html
This link is very good ... for windows:- ruclips.net/video/wGbiT6IxGP0/видео.html.
Managed to programme 5 x black pills with the USB/dfu bootloader ...
Successfully loaded a sketch to all 5 using the USB bootloader via the Arduino IDE .... so it can be done.
/usr/local/bin/dfu-util -d 1EAF:0003 -a 2 -D /tmp/arduino_build_5957/Blink.ino.bin -R
dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2019 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to sourceforge.net/p/dfu-util/tickets/
Opening DFU capable USB device...
ID 1eaf:0003
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #2 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 1024
Copying data from PC to DFU device
Download [ ] 0% 0 bytes
Download [= ] 6% 1024 bytes
Download [=== ] 12% 2048 bytes
Download [==== ] 18% 3072 bytes
Download [====== ] 24% 4096 bytes
Download [======= ] 31% 5120 bytes
Download [========= ] 37% 6144 bytes
Download [========== ] 43% 7168 bytes
Download [============ ] 49% 8192 bytes
Download [============= ] 55% 9216 bytes
Download [=============== ] 62% 10240 bytes
Download [================= ] 68% 11264 bytes
Download [================== ] 74% 12288 bytes
Download [==================== ] 80% 13312 bytes
Download [===================== ] 86% 14336 bytes
Download [======================= ] 93% 15360 bytes
Download [======================== ] 99% 15480 bytes
Download [=========================] 100% 15480 bytes
Download done.
state(8) = dfuMANIFEST-WAIT-RESET, status(0) = No error condition is present
Done!
I'll have a look this afternoon. I'm currently using my programming PCBs to great effect but a native solution would be good.
Id leave the LED alone, & replace the reset button with something that isn't so BT Big Button.
I LOVE that huge button, Malcom. Really I do. When you have to press it 20 times in succession you need a big button not some piddly little reset-style button.
Hey Ralph, sorry to hear you are having trouble even with a black pill. Having to use the serial bootloader is painfull, even with your board helper. I know you have tried a number of times with the STMduino bootloader without success, I know I have had issues with a SAMD21 based board with a similar problem and it turned out to be down to the quality of my USB cable - as stupid as it sounds. When I switched to a new higher quality cable, the issue went away.
One thing you can try to test is putting on a different USB capable firmware, like flashing it to be a black magic probe, which is a very useful thing for a blue pill to be anyway. If you try a new, high quality cable, follow this medium.com/@paramaggarwal/converting-an-stm32f103-board-to-a-black-magic-probe-c013cf2cc38c and it works you will not only have diagnosed the USB issue, you will also have a fully fledged STM32 debugger that you can also program boards with and is better than just the vanilla ST-Link V2.
The Black Magic probe definitely sounds interesting. As long as it runs on my CKS32 clones!
I heard the same "story", but it wasn't FTDI that decided to brick clone chips, it was Prolific.
Whoever was responsible, it was not a very nice thing to do, Bora. I've discovered some of my "FTDI" USB to Serial adapters are not FTDI at all - there are no markings on the chip at all. I just hope they keep working. At least I have one genuine one!
@@RalphBacon Unfortunately china can copy any tech they want to. In order to open a manufacturing plant in china, investors are required by law to give all the "blue prints" of any thing they will manufacture to the chinese government. Appereantly, these prints are not kept in a vault.
And Huawei wonder why we're all suspicious! I have a Huawei phone and got updated to Android 9 Pie a couple of days ago. I was relieved to see my phone working afterwards still. I was dreading a message such as "You are no longer authorised to access the UK telephone network. Please see your supplier. Good Luck with that."
FTDI did it twice, once in 2014, then again in 2016
notes from the 2014 incident:
www.miklor.com/COM/UV_ClonedChips.php
arstechnica.com/information-technology/2014/10/ftdis-anti-counterfeiting-efforts-sit-between-a-rock-and-a-hard-place/
the short version is that the clones left the vendor and device ids unlocked, so FTDI thought it would be cute to...change them to zeroes, effectively rendering the device useless until ven and dev were rewritten
and in 2016, they tried again:
hackaday.com/2016/02/01/ftdi-drivers-break-fake-chips-again/
then in January 2016, they decided that since that was such fun, injecting “NON GENUINE DEVICE FOUND!” would improve customer relations...
Prolific never went that far, just set their drivers to not play when a counterfeit chip was detected, you could downgrade to an older driver and the device would still work
(groan) Locate stm32flash serial tool in your Arduino IDE. Mine is here: ~/.arduino15/packages/stm32duino/tools/stm32tools/2018.9.15/linux/stm32flash/stm32flash
# A raw QFP chip can come from the factory all locked up -- so sometimes you have to do these three steps:
# Disable read protect
stm32flash/stm32flash -k /dev/ttyUSB0
# Enable write
stm32flash -u /dev/ttyUSB0
# Erase
stm32flash -o /dev/ttyUSB0
# Write bootloader
# LED is active low on pb12 on Black Pill
# LED is active low on pc13 on Red/Blue Pill -- This is also the LED_BUILTIN
stm32flash -w generic_boot20_pb12.bin -v -g 0x0 /dev/ttyUSB0
Did all that, not once, not twice, many times after uninstalling all existing drivers, reinstalling etc etc yada yada. Everything works _exactly_ as it should up to the point I plug it into my USB port for Windows to enumerate. I will attempt this some time later, on a cold November afternoon - and it will magically work, you'll see.
@@RalphBacon (clenches fists in frustration) *THAT* is it, you are using Winders! Microsoft hates us to use USB devices that do not pay royalties. If you just lived in Arkansas, I would drive over to help out. (puts down hamburger) Well, I do not use Winders, but "Zadig" is the program that the cool kids use to assign non-sanctioned drivers to USB/ACM devices ... zadig.akeo.ie/
Use another computer. Maybe boot Linux from a pen drive, and do a "dmesg" and/or "lsusb" after plugging in your Pill, then see if VID:1EAF PID:0004 shows up. After that, at least you will know if it is your PC, or Pill Board. I assume you put the boot jumpers to off/off ... I should not antagonize. It is a shame the stm32duino site down.
Yes, various problems have beaten me to submission as well. Sometimes I can not find my glasses, when they are in my pocket.
Do not go gentle into that good night,
Rage, rage against the dying of the light.
@@GnuReligion Yes, STM32duino been down for a while now, weired. Wonder if they got hacked ?
@@noweare1 They planned to close and archive stm32duino last year ... it was expensive and time-consuming for Roger Clark to run.
github.com/rogerclarkmelbourne/Arduino_STM32 has a link to a still-active gitter group. Guess we are stuck with accessing the old posts through the WayBack machine.
Hard to swallow all these pills
Ha ha! Don't worry, Bernd, next week's video is not about any pills at all. But it will be interesting, I hope. And I might even include that missing speed test. Stay tuned!
Nice idae to make a PCB for the connections, I have ben thinking about doing it for reprogramming boot loader on a couple of Arduinos (i.e. Arduino+programmer), but for now I stay with breadboards. I did also write a article on how to do the connections because I got bored with searching for it every time I needed to reprogram a Arduino (I will probably publish that article). When I, once in a while, publish some Arduino stuff you can find it here: lygte-info.dk/project/indexProjects%20UK.html
Doing a PCB without a schematic is a big NO for me. Anytime I want to order a PCB I do a schematic first, then the layout. With KiCad you even have to add the holes on the schematic (I want a DRC without errors, but with KiCad I cannot get a ERC without errors, making ERC nearly useless).
I am very curios about your new speed test
I have learned my lesson, Henrik, no more PCBs without a schematic first. I will check out that link, tomorrow but for now I'm off to watch some TV, it's been along day! Great to hear from you, thanks for posting.
use a 1k for the red LED and a 10k for the true green LED, I tryed it yesterday.
Thanks for your post, Jens Schröder, good to hear from you. I am also going to swap the position of the resistor and LED so it is very visible!
And that is what I did in my V2 board with:
- swapped LEDs and resistor positions
- used resistor values as you suggested
- used a 40-pin ZIF socket for the STM32
- solder the FTDI module directly to the PCB
All up and running, a vast improvement all round! Thanks for the resistor values, Jens!
www.dropbox.com/s/qno1c1bi7pe6gbq/V2%20Snapshot%20Hi%20Res.jpg?dl=0
I bulid something with a CD4001 (5V) and red, yellow and green LEDs. For red and yellow I use 1k, for the true green LED I changed it to 10k Resistor.
kosher is Jewish/Hebrew word adopted by many cultures
As long as nobody is upset at me using that (common) UK expression, that's fine!
I had really hoped to see no Arduino IDE here. Why using this Arduino environment with a proper ARM SoC? There is so many code overhead with the Arduino IDE. And you are not really programming the ARM SoC. The GCC compiler is pretty clever. Just use Eclipse with ARM SoC's ;-)
The main reason for using the Arduino IDE is familiarity for a huge proportion of my audience. As you know I use the Eclipse IDE (but am moving to VS+Platformio as Eclipse for Arduino has reached the end of its life).
Now, does the Arduino IDE use a different compiler compared to Eclipse, Arjan? I thought it was the same GCC compiler. If so, what are the Arduino IDE's overheads you mention? Same code generated, surely?
Sir, you're such a gentlemen, lol. For me, Kosher means the exact opposite though: disingenuous, fraudulent, a sham. They earned this meaning for me when they started producing all those anti-white, anti-European political propaganda films from their Hollyweird.
I was unaware of any alternative meanings of this word (culture blindness).
I shall endeavour not to use it as it obviously means different things to many people. I am aware of many USA words that have different meanings across the pond, some of which I cannot repeat here.
But as a typical, clean example, what does "homely" mean? To Brits it means where the home is, comfortable, cozy, mum's making you a cup of tea by the fireside. To our cousins in America, it means ugly, or at least unattractive. They use "homey" to mean cozy which we don't recognise in the UK at all. Homey means nothing, it's not a word.
So it's easy to get it wrong!
@@RalphBacon Sir, it's no mistake at all what you call "Kosher," as I too have a cultural blind spot. No worries. I like how Brits speak, it's just that one term threw me off a slight bit. Sorry about that.