stm32f417 not able to boot to flash - Page 1
Forum section: electronics / general

author: kody
author_rank: Contributor
timestamp: October 28, 2014, 08:34:45 am
content: Hi,I have creating a .bin file configured to make the chip run as VCP. I flashed the .bin using busblaster successfully. But, when I connect the board to USB and check for devices in Device Manager. It does not show up as com port. It is enumerating as STMicroelectronics STM32 BOOTLOADER .Even though I toggle the switch between bootloader and flash. It is only recognizing bootloader. I tried setting BOOT 0 to high but still no difference.Please suggest any solution.Thanks,Kody

author: Jeroen3
author_rank: Super Contributor
timestamp: October 28, 2014, 11:07:21 am
content: Boot0 should be low during the 4th sysclk.However, there are OTP en reset options for booting to dfu. Did you set those?

author: kody
author_rank: Contributor
timestamp: October 28, 2014, 05:16:41 pm
content: Hi Jeroen,I want to boot to flash memory where my binary is located. But, it is currently being detected as DFU mode(IN USB list of Device Manager)It should be enumerating as com port.I did not set any other options like OTP en reset. Is there any other way to make it run the code in flash?Thanks

author: Jeroen3
author_rank: Super Contributor
timestamp: October 29, 2014, 06:34:00 am
content: Is your binary valid? Does it work when you swd it in?Maybe your binary need to be signed (as it requires with nxp's dfu and msc-dfu)

author: kody
author_rank: Contributor
timestamp: October 30, 2014, 12:43:39 am
content: The binary is valid. I am trying to boot with external clock.

author: Jeroen3
author_rank: Super Contributor
timestamp: October 30, 2014, 07:54:51 am
content: The chip cannot boot with external clock. It always boots on its internal clocks.Then user code can choose if it wants to switch to external clock.There are two ways the chip enters its bootloader:- Method 1: hardware detects a low on BOOT0 and sets the memory remap registers according to BOOT1, if available.- Method 2: your code does the preparations and jumps to the bootloader ram.As described in the three links here:https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2FSTM32Java%2Fjumping%20to%20the%20bootloader%20via%20software%20does%20not%20permit%20dfu%20mode&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000F9A0E3A95BA69146A17C2E80209ADC21&currentviews=214You're obviously not doing 2, you'd know. Verify the status of BOOT0 a few uS after reset is pulled high.If your user code is invalid, as in empty flash, it should do nothing. Some other brands jump to bootloader. Correct me if I'm wrong.Try to reset all peripherals before you use them. Or do a full chip reset (maybe in software) when the bootloader was used.

author: paulie
author_rank: Frequent Contributor
timestamp: October 30, 2014, 11:10:02 am
content: Quote from: Jeroen3 on October 30, 2014, 07:54:51 amIf I'm not mistaken the bootloader runs with BOOT0 high not low. Normally there is a pull down there for stand alone operation. It's surprising how much confusion there is over this in the tutorials and forums. May be due to mislabeling of those jumpers on MOST of the Ebay STM32 clone boards. The original LCsoft versions were correct.It is true that the "run user" box must be checked when bootloading or BOOT0 must be low when resetting to run the program. Also note that the board must be reset before another program can be downloaded.

author: Jeroen3
author_rank: Super Contributor
timestamp: October 30, 2014, 11:53:59 am
content: True, I was mistaken about BOOT0 polarity. The reference manual is pretty clear about this. I usually design buttons are active low, thats why. My first post was correct thoughUsually, dfu instructions require the device to perform a full power cycle when completed. This is to prevent any anomalies or remains of bootloader variables in SRAM or other registers.Please also note that when you haven't implemented a soft-connect/disconnect feature, the USB host will not re-enumerate the device.

author: kody
author_rank: Contributor
timestamp: October 30, 2014, 04:07:24 pm
content: Is it necessary to enter bootloader mode? To get the external clock run the chip.I program the mcu with a vcp hse binary by using the normal clock. After powercycle and providing the external clock it does not show up in usb list.

author: paulie
author_rank: Frequent Contributor
timestamp: October 30, 2014, 04:21:24 pm
content: The bootloader does not use external clock but needs user code to do that, as Jeroen3 explained perfectly in reply #5. It pays to read what people trying to answer your questions have to say.ps. 99.9% of the time when noobs claim their chip is "bricked" or not working as expected it turns out to be a bug in their program or failure to read datasheets. Modern ICs are very hard to damage and factories careful not to ship defective product. Claims of "fakes" and counterfeits are highly exaggerated too.

author: kody
author_rank: Contributor
timestamp: October 30, 2014, 04:28:39 pm
content: I did read reply.What I wanted to say was I do not want to enter the bootloader mode.I want the external clock to drive the chip.

author: paulie
author_rank: Frequent Contributor
timestamp: October 30, 2014, 04:30:42 pm
content: You need to load a program that switches to external clock and bootloader mode is the best way to load a program.

author: kody
author_rank: Contributor
timestamp: October 30, 2014, 04:37:40 pm
content: I have already set the flags required to enable hse. Would that not be sufficient?

author: paulie
author_rank: Frequent Contributor
timestamp: October 30, 2014, 05:02:52 pm
content: Switching to HSE is not always simple. How do you know external clock is not enabled? USB is not a good way to tell because many other things can prevent that from working. I suggest a simple blinky program to show a big change in rate compared to internal.It is considered very rude to start new threads for the same question. It's not obvious if this is an age or language problem. Best to at least show country in your avatar. Unlikely sex offenders will track you down with such general info.

author: kody
author_rank: Contributor
timestamp: October 30, 2014, 05:04:26 pm
content: so enable the required hse flags/settings for sample blinky program and test?

author: paulie
author_rank: Frequent Contributor
timestamp: October 30, 2014, 05:06:34 pm
content: It is considered very rude to start new threads for the same question. It's not obvious if this is an age or language problem. Best to at least show country in your avatar. Unlikely sex offenders will track you down with such general info.

author: AndreasF
author_rank: Frequent Contributor
timestamp: October 30, 2014, 06:59:21 pm
content: Quote from: kody on October 30, 2014, 05:04:26 pmYes!From the various threads here (and on the ST forum) it's quite clear that there are multiple things going on. First it was the question about the external clock, which you claim to have solved. Then it was the issue of the internal bootloader starting up, even though you don't want it to. This is strange, as you wouldn't be able to switch to an external clock unless your chip runs your code (the internal bootloader runs from the internal oscillator). As Pauli said, the (rhetorical) question is, how did you verify that you indeed ran from the external oscillator, after you fixed it? You know there is a bit in on of the registers that tells you if the HSE is ready, right? Right???Lastly, there is the issue of the nondescript binary that you're trying to get to run for some VCP (virtual Com port, I assume) function via USB. There are multiple potential failure points here that would all need to be checked (again, as Pauli said). It sounds like that was running at some point in time. So, can you go back to that original hard- and software configuration to make it work again?So, yes, the best course of action is to check one thing at a time with as simple as possible code, then incorporate that code into more complex code. USB is not simple.

author: paulie
author_rank: Frequent Contributor
timestamp: October 31, 2014, 01:27:53 am
content: I see now dannyf had the KISS philosophy covered in one of the duplicate threads. OP would be wise to heed the same advise from all directions now.Andreas, I have a question that's been bugging since I came here. Whats with the periodic table avatar photos? Is this a secret cult or something to do with the forum? Do you get one for buying a tee shirt? Is it explained anywhere?

author: Jeroen3
author_rank: Super Contributor
timestamp: October 31, 2014, 06:25:51 am
content: Use ST's peripheral library for clock configurations. Or steal them from a working project, a random RTOS such as chibios for example.You cannot "just enable the flags".You'll need to insert waits for it to stabilize, then switch multiplexers and reconfigure the PLL, which is a entirely new story.

author: AndreasF
author_rank: Frequent Contributor
timestamp: October 31, 2014, 06:56:06 am
content: Quote from: paulie on October 31, 2014, 01:27:53 amI have no idea, really. It was just one of the built-in options on this forum, so I picked one that sort of fits for me.

author: kody
author_rank: Contributor
timestamp: November 03, 2014, 05:03:05 pm
content: Quote from: Jeroen3 on October 31, 2014, 06:25:51 amThe waits are already presenting in existing system_stm32f4xx.cBy setting the pll values the mux is being switched and pll is reconfigured.thet is why the main difference is setting the pll values and enabling the flags

author: paulie
author_rank: Frequent Contributor
timestamp: November 03, 2014, 10:51:36 pm
content: Quote from: AndreasF on October 31, 2014, 06:56:06 amWell that's a big disappointment. I was hoping it was some secret society like Freemasons or the Opus Dei prelature. I never "applied" for a photo so didn't notice. Thanks for explaining.Kody from Canada! So we are not too far away unlike some of these dad burn furriners.For getting a handle on the PLL/HSE tangle this file from westfw in the $1 thread was key to understanding for myself and a couple friends who wanted to know exactly what goes on behind the scenes. C versions were less help there so hopefully you won't be scared off by the "a" word. He even included a table and discussion of wait state requirements.

author: kody
author_rank: Contributor
timestamp: November 04, 2014, 04:35:20 pm
content: Quote from: paulie on November 03, 2014, 10:51:36 pm

author: paulie
author_rank: Frequent Contributor
timestamp: November 04, 2014, 04:56:13 pm
content: IDK about racist. Maybe nationalist or xenophobic. Not sure what "race" canadians are but I'm half kanuck myself.To be honest your question doesn't make too much sense to me. I do know the procedure in that code works and have successfully tried several different versions to change the blink rate and experiment with wait states. Obviously every step is included there with nothing hidden. Westfw does provide a more detailed explanation later in that thread:https://www.eevblog.com/forum/microcontrollers/one-dollar-one-minute-arm-development/

author: westfw
author_rank: Super Contributor
timestamp: November 06, 2014, 12:59:05 am
content: QuoteDo you understand that the ST chips are fundamentally different in their clock configuration from something like an AVR (or most other 8bit chips?) On an AVR, the clock source is controlled by fuse bits, and you can program the fuse bits ONCE for a desired clock, and it will stay that way while you load multiple other applications in the code memory. Arduino does this, for example.On the ST ARM chips (and quite a few other ARMs), EVERY APPLICATION has to configure the chip's clock in whatever way is desired. The chip ALWAYS starts running on the internal RC clock, and you have to do the (rather complex) dance with enabling the HSE oscillator and configuring the PLL if you want the application to run at "full speed."Each method has advantages (you can't brick an ARM by configuring it for an external crystal when there is none connected) and disadvantages (I count at least 64 bytes of code to configure a PLL-based clock.)I don't know if this has anything to do with not being able to run your app from flash. :-(Some USB apps (probably including the bootloader) set up the clock to run from a USB-based PLL rather than either HSI or HSE. I think.

author: kody
author_rank: Contributor
timestamp: November 07, 2014, 04:03:28 pm
content: ^ That is useful info @westfw