joeltroughton / uSMU

Credit card-sized, USB-powered 4 quadrant source-measure unit hardware and firmware
Other
93 stars 31 forks source link

Programmer Used? #2

Closed swartr closed 2 years ago

swartr commented 2 years ago

Hi, we're trying to program one of your boards but have been running into trouble with the programmer and subsequently can't upload the software. Can you describe which programmer you use and the layout of the 10 pins on the board?

joeltroughton commented 2 years ago

The programming header is a standard 10-pin SWD header with the same pinout as here. For programming, I used a J-Link EDU Mini which has an identical pinout. If you're having issues, maybe check your ribbon cable is correctly oriented?

swartr commented 2 years ago

I've been using a cheap Chinese STlink v2 with 10 pin JTAG/SWD adapter. I think the pinout should be right but the programmer disconnects every time I try to hook it up which makes me think Its probably not the best setup.

The J-Link EDU is out of stock everywhere. Have you tried any alternatives?

joeltroughton commented 2 years ago

I've also had it working with the ST-Link snap-off from a Nucleo dev board. Is the uSMU board powered via USB when you're trying to flash? The programmer doesn't supply power

swartr commented 2 years ago

It doesn't matter either way. The 3.3V is not connected to the programmer then? I thought the 3.3V of the SWD was supposed to power as well. This is the way it works, for example, with the bluepill/ blackpill boards. I was expecting something similar with the 3.3V powering and also illuminating the D1 status LED.

It could just be that my board is dead on arrival or I burnt it. Is D1 a status LED for the 3.3V rail or is there a good test spot I can probe to check for 3.3V?

joeltroughton commented 2 years ago

As I understand it, the 3.3V on the SWD connector is just to indicate the correct voltage to the programmer. D1 is a general status indicator for the microcontroller, so won't give any meaningful indication until the MCU has been flashed.

A good place to test for 3.3V would be the row of decoupling caps at the top of the MCU (C1-4). It would also be worth checking for any solder bridges or opens on the MCU as the pitch is quite fine. I've had programming fail before and it was normally from the MCU being improperly soldered

swartr commented 2 years ago

Thanks that's all helpful!

We ended up purchasing a J-LINK EDU mini - took a while to find any in stock so I imagine that they are probably going to discontinue it. We ended up getting all of them to program (all 11 minus the initial one I probably killed) but It would be helpful to find alternates since there aren't really any other SWD programmers that are sold with the 1.27mm 10 pin JTAG pinout.

A few notes (some just to help others): -You recommend Stm32CubeIDE 1.5.0 but you end up getting a warning about non-compatibility unless you're on a higher version. I used 1.8.0 (which I used) and didn't migrate the code to the newer version. -The ee.h file is linked to a folder on your computer. To get the code to compile you have to add the ee folder that's included as a path. -If you plug the board in (unprogrammed) to a computer, Windows will recognize it as a USB controller. This is probably the best indicator I've found that the stm32 is correctly soldered and working. D1 does flash green for a quick second too (unsure why). -The "SWD" marking is pin 1 (VCC) for the JTAG pinout and plugging it in wrong probably burns out the stm32. This is probably what I did with the first board. -After programming, all the commands are sent to the board from a Serial connection at 115200 baud. The STM IDE doesn't have a serial connection natively so you need to add one of you want to test the board through that program: I added the TM Terminal: https://community.st.com/s/question/0D50X0000BNv7IQ/does-stm32cubeide-offer-a-serial-terminal-this-functionality-was-available-in-the-atollic-truestudio-product -After programming, D1 is purple

Haven't calibrated them yet but will update if we have more problems.