2010-09-27 09:50 AM
Hello. I'm trying to make a simple experiment with the discovery board - read data from an SD card and output it to the DACs. I've set up the DACs with the examples from UM0427 and they work right, and i've changed the default pinout for SPI - because the default one uses the DAC pins. Unfortunately, the alternative pinout uses the JTAG pins, and after I disabled JTAG in software and ran the app, I realized maybe I shouldn't have done that - can't flash the board anymore, because the SPI clock outputs on the JTAG data lines too fast after reset.
So I've unsoldered JM16 on the board, which makes BOOT0 to be pulled-up at 3v3, ran the AN3155 USART bootloader and erased the old software. Now I can use ST-Link flashing/debugging again. Any smart hacks I could try to use hardware SPI and STLINK? I think flashing via USART is the only available option.2010-09-28 12:52 PM
An easier way of starting boot mode is to put a 220R resistor between BOOT0 and 5v - doesn't need soldering and easier to take out :)
2010-09-28 01:14 PM
Yes, it's not necessary to solder. But since boot0 isn't marked as 5V tolerant (maybe it is anyway) it's probably preferable to bring it to 3.3V, either direct (I do) or with a strong pull-up. It's pulled low with 510 ohm so 100 ohm or so to 3.3V will probably work. (or 270 to 330 ohms to 5V will keep it below 3.3V on the pin)
2010-09-28 03:03 PM
The reason for 220R to the 5v line is that they are adjacent to each other (bar a couple of pins) wherease the 3v3 line is over the far side :)
The STM32 seems pretty robust ; I wired the PSU in backwards once (pillock !), and it emitted a short burst of steam and smoke. Despite this it still seems to work absolutely fine :) I'll change that 220 to a 270 in the blog I think. On mine it gives 3.4v which it doesn't seem to mind, but according to the docs BOOT0 isn't 5v tolerant. It requires at least 0.7Vdd to be logic '1' which gives a max R of about 440 ohms.2010-09-28 07:53 PM
If you unsolder JM16, a weaker onboard pullup will set boot0 to 3v3, thus enabling the factory bootloaders upon reset. From that point, you can either force-jump to a memory/flash location from the bootloader to start your software, or use a floating wire (I'm breadboarding, so it's rather simple) on BOOT which shorts to ground, thus setting BOOT0 at logic 0, and starting the programmed application after a reset.
This isn't my problem, since i disabled jtag and re-enabled it from USART :). My question is: how can I use the DAC and SPI at the same time, with ST-Link enabled? The SPI CLK pin won't work - but maybe I can start a timer to output a signal synced to CLK (we know at what speed it will run) when SPI TX begins, and alternatively a TX done interrupt can delay the signal a bit between each byte, so the (timer generated) SPI CLK won't run out of sync with the actual data? Any other ideas?2010-09-29 03:24 AM
I don't understand what ST-Link have to do with this. Doesn't that only affect PA13 and PA14?
But SPI1 and DAC's is on the same pins, so that won't work. Can't you use SPI2 instead? Or remap SPI1?2010-09-29 11:49 AM
Well, it's really simple.
SPI1 default mapping overlaps the ADC. SPI1 alternative mapping overlaps the JTAG. As far as I can tell from the datasheet, there is no SPI2.2010-09-29 12:32 PM
> SPI1 alternative mapping overlaps the JTAG.
Isn't it one of the examples that disables JTAG to use the pins as regular IO? (Haven't tried it though) > As far as I can tell from the datasheet, there is no SPI2. Have you had a look at, for example, page 14 in the VL-discovery user manual ;) (PB12-15)