ST LINK Error (DEV_TARGET_HELD_UNDER_RESET) - stm32

So I'm using an STM32F103C8T6 board and it was working fine a few days ago but then tried to load a code with keil vision compiler these days and it showed this message STLINK Error(DEV_TARGET_HELD_UNDER_RESET).
After that using the STM32CubeProgrammer also shows the same problem, only connects with the "hot plug" mode
as you can see here
Its cleary a reset error, but I really dont know how it happened and don't find much resources on the internet with this problem and now I can't download any code in my stm32f103 board it shows
this message
After researching on the internet found it might be soldering problem, but I dont think its the case, i'm only using the microcontroller, not any bread board circuit, and it was perfectly fine days ago. All my write and read protections checkboxes are unchecked in the STM32CubeProgrammer sections too.
I guy on the stcommunity just said "he went through all CPU pins and the board started working." but is it a problem with the pin reset? in the STM32F103C8T6 board it has a reset buton but how can a search a problem in it?

Ok, this is what I did and now it seems to be working (I'll try to be as descriptive as I can, so you or anyone who's got stuck into this can compare):
I'm using STM32CubeProgrammer v2.6.0 under Ubuntu. The parameters to connect to the target are:
Port: SWD
Freq: 4000 kHz
Mode: Normal
Access Port: 0
Reset Mode: Software reset
Shared: Disabled
I'm using an STM32f4 Discovery as a programmer, to achieve this the jumpers should be disconnected. It is supposed that SB11 jumper (under the board) should be unsoldered too, but as you will see I'm not using the reset line on SWD. The target (STM32F103C8T6) is powered independently (+3.3V).
The connections between the target and programmer are the following:
Prog pin1 (VDD) --> NC
Prog pin2 (SWD Clock) --> PA14 (Pin#37)
Prog pin3 (GND) --> VSS (Pins# 23,35,47 and 9 if common digital analog ground)
Prog pin4 (SWD I/O) --> PA13 (Pin#34)
Prog pin5 (NSRT) --> NC
Prog pin6 (SWO) --> NC
I have access to the target's NSRT (Pin#7) through a push-button (this is important).
Once all this is ready, what I did was to press and hold the reset button, then press the connect button in STM32CubeProgrammer (without releasing the reset), and wait just two seconds, then release the reset. After this process, the target was connected and I was able to program it normally.
The program will not run immediately, you need to push and release the reset button again.

Juliane - the (DEV_TARGET_HELD_UNDER_RESET) message means that something is holding nrst to ground. You can't do much apart from 'hot plug' when in this mode. If you have a reset button then it may have failed in a connected position which will pull NRST to ground defeating the internall pullup.
Can you check the resistance across you reset button in down and up position. I suspect it is 0 ohms (or at least lower than internall pullup resistor).
If you don't have a reset button then check to see what circuitry is around NRST and try to work out why its pulling to ground.

First you need to clear the existing flash memory
it can be done with ST Link Utility or STM32CubeProgrammer
Hold down Reset button while clicking 'connect' on STM-Prog, then navigate to 'Erasing & Programming' and click 'Full chip Erase'
or
while holding reset click Full Chip Erase on ST Link Utility
After the chip is clean try setting the Debug to Serial wire
this will allow to flash new code to the board multiple times without having to clear the flash memory or holding reset before upload
in Pinout & Configuration
or in stm32f1xx_hal_msp.c

"DEV_TARGET_HELD_UNDER_RESET" can also have a hardware reason. I experienced this by accident with a PCB where I mixed up some numbers and ended up with a 10 Ohm resistor instead of a 10k Ohm resistor between 3V3 and the NRST pin on a G431RB. Usually I use a 10k resistor to connect the Reset Switch to the NRST Pin.
The end of the story was, that I was not able to connect to the MCU, the error message was "DEV_TARGET_HELD_UNDER_RESET" and I had some hard time to figure out what it was. Once I replaced the 10 Ohm Resistor with the correct value (10 kOhm) anything worked fine.

Related

BBC micro:bit extension adding failed for Scratch

I bought a new micro:bit v2 board, and want to add it to Scratch as an extension. I followed the 2 steps from https://scratch.mit.edu/microbit. The step 1 is ok, the led lights of my micro:bit board is flashing 5 characters "zepiv", but the step 2 failed.
The scratch link is running, and the bluetooth is enabled.
The os version is macOS Big sur 11.4(Mac mini late 2014), the bluetooth LMP version is 4.0(0x6).
The weird thing is that the board isn't visible to my Mac, but it is to my Android cell phone.
Is this a problem with my computer? Could anyone help me? Thanks in advance.
Good question, I had a lot of trouble with the same issue when connecting my LEGO MINDSTORMS EV3© to scratch. If you want to connect a device easily a good idea is to have it paired via Bluetooth already. To pair it with a mac:
Open the settings app
Select Bluetooth
Switch your micro:bit into pairing mode:
Hold down buttons A and B on the front of your micro:bit together. The front is the side with two buttons and the LED display. Keep the two buttons held down. Don’t let go of them yet!
While still holding down buttons A and B, press and then release the reset button on the back of the micro:bit. Keep holding down buttons A and B.
You should see “PAIRING MODE!” start to scroll across the micro:bit display. When you see this message start to appear you can release buttons A and B.
Eventually you’ll see a strange pattern on your micro:bit display. This is like your micro:bit’s signature. Other people’s micro:bits will probably display a different pattern.
(I found these instructions at this website)
In the Bluetooth menu, look for your micro:bit device and select Pair
After the device has paired, go back to scratch with scratch link activated, and attempt to connect to the device again.
This worked for me when I connected my EV3 device and I hope it helps you.

STM32F103C8 resets after a couple of hours

I have an STM32F103C8 board and my program is switching the GPIOB1 with frequency of 500KHz.
At first, microcontroller runs the program perfectly but the main problem is that MCU resets after a couple of hours and stays at reset mode until I disconnect the board from the power supply. If I power the board immediately after disconnecting, MCU will not work but if I power the board few minutes later, the MCU works properly just for a couple of hours and after that, the same problem is repeated.
I already faced another problem that this issue was happening after 15 minutes, I added a 10uF capacitor to the VDD3 pin and now, this problem(going to reset mode) happens after about 5 or 6 hours.
Do you have any suggestions about hardware or program?
What should I do with the reset pin? (Currently, I'm pulling up nRST pin with a 10K Ohm resistor)
Can this happen because of the wrong power-up sequence on VDD, VDDA, and nRST pins?
Is this similar to a clock malfunction?
This is the schematic
Thanks in advance,
Amir

STM32F302R8 Custom Board Blink an LED Problem

I am a new STM32 user migrating from Atmel/Microchip's SAMD line.
I created my first project following along the tutorials here: https://www.youtube.com/watch?v=x_5rYfAyqq0&t=682s. It's a motor driver, with some other hardware shown outside of the screenshot below, but at the moment I am just trying to get statusLED to blink. I can successfully connect to the board with an STLink, when I press debug and resume, my LED will momentarily flash which I capture on video and scope, shown in the video here.
Strangely I don't lose connection to the board or anything, and my program continues to execute, but nothing else happens. As you can see from the code it's supposed to just blink every 500ms. Does anyone have an intuition as to what might be going on?
Here's a video showing the momentary flash (The LED is in the bottom right corner of the board and I press the debug/resume buttons off camera)
https://photos.app.goo.gl/BfGQbW1SX8EJT5eV8
I am using the internal clock for debug purposes, and only have Trace Asynchronous Sw debug + the statusLED set as GPIO output. My only added code is:
HAL_GPIO_WritePin (statusLED_GPIO_Port, statusLED_Pin,GPIO_PIN_SET);
HAL_Delay (500);
HAL_GPIO_WritePin (statusLED_GPIO_Port, statusLED_Pin,GPIO_PIN_RESET);
HAL_Delay (500);
Also here's the board schematic:
STM32F302R8 Board Layout
HAL_Delay depends on the SysTick interrupt being enabled and hooked up to the HAL.
You need to call HAL_Init() from main(), which in turn calls HAL_InitTick().
After that you need the function:
void SysTick_Handler(void)
{
HAL_IncTick();
}
The example projects in the STM32Cube package will include this.
if you configured your Hardware with CubeMX:
check your CubeMX configuration if your GPIO is set up correctly as "GPIO Output" in "Open Drain" oder "Push Pull" mode. According to the schematics "Open Drain" would be my recomendation, but Push Pull would also work.
One of my favourite mistakes is clicking one line to low in CubeMX, selecting "GPIO_Analog" for the pin instead of "GPIO_Output" and searching the code for a long time for a bug where there is none ;)
This turned out to be my having pulled up Boot0 with the intention of using a bootloader, and then forgetting about it. So I rotated my Boot0 resistor to be a pulldown and everything is working now.
Still unsure what configuration is going on to get the brief LED flash in the video, but definitely consider this resovled.

Can I use TFT LCD and USB FS Mode at same time with STM32F429I

Hello everybody I am trying to make an STM USB HOST and taking some datas from keyboard and this data will show on LCD Panel.
But somehow I can't set the pins by using CubeMX. The program gives error when I try to open TFT-LCD properties after I opened USB HOST Mode. The program says the two features use the same pins.
Is it possible to open same properies at the same time?
Part numbers beginning with STM32F429I are in 176-pin packages that have enough pins to support both TFT and USB-FS at the same time. I've tried it in an empty project with a STM32F429IET MCU, the USB pins ended up on PA11 and PA12, and the TFT pins are all over the place (layout designers just love it). Now trying to find out what can cause the conflict. Clicking on PA11 reveals that the pin could be configured to LTDC_R4, but this function is assigned to PH10. Click on PA12, it could be configured to LTDC_R5, but this function is mapped to PH11. Of course, if you have set PH10 or PH11 before to some other function, then you have a problem.
Now I have a feeling that you are not designing hardware but trying to do stuff on an existing board. In this case, you can't define the pinout. Find the board schematics in the documentation, then work from there, assigning functions to pins according to their intended function. Trace the connections from the USB socket to the MCU to find out which pins are connected to it, then use the pin function mapping table in the datasheet to find out which USB controller can talk to it. Then activate that interface in CubeMX, and verify that it got mapped to the right pins. If not, you can hold down CTRL and drag it to the right place. Pin down the verified pins with the right mouse key, otherwise CubeMX will rearrange them at the hint of a conflict. When all pins are set, save a backup of the project as a baseline to return to when you start another software project on the same board.

xrandr: jail mouse

I already asked this questions over at Ask Ubunutu. Unfortunately I have not received an answer. As this question is not Ubunutu specific, I am trying it here.
I am using xrandr via console to enable/disable secondary monitors. This work fine so far. Unfortuantely if I move my mouse beyond one screen, it appears on the other one. How can I disable this feature - and lock the mouse to one screen?
I use Ubunutu 10.10 and awesome - no gnome/kde.
I've never seen anything in the Xrandr or Xinerama docs about restricting mouse movement to a single monitor.
And, before Xinerama, I used to run multiple X screens on multiple monitors, but the mouse moved freely between the monitors without trouble. (Windows were stuck on the monitor they started on; it worked much better than it sounds. :) So that's probably out.
You may be able to solve this starting another X server. Configure the second X11 for the correct screen, no mouse (keyboard too?) input device, and start clients on that second X server using DISPLAY=:1 xterm & and so forth.