Error in initializing st link device reason no device found on target

Need help! Плата: STM32F103C8Программатор: ST-Link v.2 (версия V2J36S7)Среда: STM32CubeIDE (версия 1.3.0)

Need help!
Плата: STM32F103C8
Программатор: ST-Link v.2 (версия V2J36S7)
Среда: STM32CubeIDE (версия 1.3.0)

Проблема:
Раньше в STM32CubeIDE прошивал платы STM32F4Discovery, все было хорошо. Сейчас взял программатор ST-Link, обновил в нем прошивку, создал в STM32CubeIDE проект мигания диодом под плату STM32F103C8, прошил и тоже все хорошо. Потом, случайно зашел в старый проект под плату STM32F4Discovery и им прошил плату STM32F103C8. После этого возникла проблема, что больше никак не могу прошивать плату STM32F103C8, всегда пишет:

Изображение

И в консоле:

Код:

Starting server with the following options:
        Persistent Mode            : Disabled
        Logging Level              : 1
        Listen Port Number         : 61234
        Status Refresh Delay       : 15s
        Verbose Mode               : Disabled
        SWD Debug                  : Enabled

Target no device found

Error in initializing ST-LINK device.
Reason: No device found on target.

Вопрос: Что сделать чтобы плата STM32F103C8, которая была случайно прошита при настройках на плату STM32F4Discovery, опять начала прошиваться? (С новыми платами STM32F103C8 программатор ST-Link v.2 работает нормально в STM32CubeIDE, прошивает то, что создано в проекте под плату STM32F103C8)

Добавлено after 1 hour 36 minutes 54 seconds:
Проблема решилась очень просто. Добрые люди подсказали (спасибо, stD).
Нужно переставить джампер BOOT-0 в положение единицы, прошить, а потом вернуть в положение нуля и снова можно прошивать STM32F103C8 в STM32CubeIDE через ST-Link v.2

т.е. из этого первоначального положения дажмперов у STM32F103C8:
Изображение
переставить в это положение:
Изображение
после прошивки, вернуть в первоначальное положение BOOT-0

Ура! :music:

Помогла эта статья, тут шикарно про BOOT-0 и BOOT-1 написано и про значение Reset у STM32F103C8
Про джамперы и bootloader (c) stD

P.S.
кто хочет поблагодарить автора статьи stD, то вот, сюда

Содержание

  1. Can’t flash code after using Standby mode. Error in initializing ST-LINK device. Reason: (4) No device found on target
  2. ST-Link & Blue Pill Development board
  3. Connecting the ‘Blue Pill’
  4. Software tooling
  5. The problem
  6. The symptoms
  7. Success
  8. The solution
  9. Bottom line
  10. Error in initializing ST-Link Device — Failed to connect to device
  11. 6 Answers 6
  12. Unable to flash a stm32 (STEVAL-PTOOL1V1) : No device found on target
  13. Error in initializing st link device reason no device found on target
  14. Кто сейчас на форуме

Can’t flash code after using Standby mode. Error in initializing ST-LINK device. Reason: (4) No device found on target

I’m experimenting with standby mode. IDE is STM32CubeIDE, mcu stm32f407vgt9. So I read in datasheet that mcu leave standby mode if one of following condition are fullfiled:

WKUP pin rising edge, RTC alarm (Alarm A and Alarm B), RTC wake-up, tamper event, time-stamp event, external reset in NRST pin, IWDG reset.

MCU get into standby mode by this function HAL_PWR_EnterSTANDBYMode() if I well understand. I do that and I expect if mcu got high on WKUP pin (PA0) mcu will exit standby mode. I want this simple code to exacute.

MCU go into standby mode but leaving standby mode never occur. I try to connect PA0 with high but nothing is happen.

I want to flash another code but that is now not possible because I go this error from STM32CubeIDE:

Error in final launch sequence:

Error in initializing ST-LINK device.

Reason: (4) No device found on target.

How I can solve this problem? Before experimenting with standby I got this error several times and I was successful solve him by connecting NRST pin with GND (hardware restart mcu) but now it doesn’t work because after reset code will be automatically execute. Connecting NRST with GND and trying to flash code it is not possible (new error will occur which indicate that currently is activated hardware reset: Error in initializing ST-LINK device. Reason: (8) Target held under reset.).

Источник

ST-Link & Blue Pill Development board

The ST-Link/v2 is an in-circuit debugger and programmer for the STM32 and STM8 microcontroller families. Due to its capabilities, it is an extremely popular device and clones are available from your preferred Chinese trading platform for less than 5 euros. I recently ordered a few of these cheap ST-Link/v2 clones for a new project. However, making them work was pretty frustrating. Read on to learn about the problem, the symptoms, and the (super) easy fix.

Connecting the ‘Blue Pill’

Over the years I’ve used occasionally the ‘Blue Pill’ which is a little development board, comparable in size with the better known Arduino Nano, but with a modern and more capable ARM Cortex M3 CPU (STM32F103C8T6).

Figure 1: ST-Link/v2 knock-off connected to a ‘Blue Pill’ development board

In the past, I used an original ST-Link/V2, but it became a victim of my last move. I couldn’t find it anymore. So I ordered a few clones on Aliexpress along with a bunch of ‘Blue Pill’ boards. The boards are certainly also knock-offs, although the CPU appears to be genuine.

I’m a big fan of Microsoft’s free and cross-platform Editor/IDE Visual Studio Code, but when it comes to ST microcontrollers I prefer to use their STM32CubeIDE. ST has come a long way integrating their stuff into Eclipse, but in 2020 it’s now working well, even on MacOS 😅.

ST provides also some optional software tools for their microcontrollers. In particular, I found the STM32 ST-Link Utility (STSW-LINK004) to be quite helpful — although it’s only available for Windows.

Figure 2: Screenshot of the STM32 ST-Link Utility

The problem

The ST-Link/v2 has a 10 pin interface through which it interfaces with the development board. The pin-out diagram is printed on top of the ST-Link/v2. After connecting the two devices, I tried to upload a simple test program, but it just wouldn’t work and the error messages were also rather cryptic.

The symptoms

Despite that the ST-Link/v2 was properly recognized, I wasn’t able to connect or upload anything to the development board. Poking around with the ST-Link/v2 settings I was confronted with the following error messages over time:

To ensure that this wasn’t a hardware issue, I tried of course several combinations of ST-Link/v2s and development boards. Unfortunately, none of them worked.

Success

Since none of my ‘Blue Pill’ development boards were recognized by none of the ST-Link/v2 programmers, I suspected a rather systematic error. Needless to say that I tried to google the error messages above, but none of the shown links were conclusive.

After some further digging through the box in which I store my microcontroller stuff, I found to my surprise another ST-Link/v2 knockoff which I must have purchased some years ago (and since forgotten about it — hi).

Figure 3: Two ST-Link/v2 knockoffs

After swapping the blue ST-Link for the black one, I was suddenly able to connect to the ‘Blue Pill’ development board!

The solution

With a working setup, I investigated why the blue ST-Links didn’t work. The most obvious difference is the pin-out diagrams printed on the respective ST-Link knock-off. Opening the blue ST-Link revealed the following:

Figure 5: ST-Link/v2 PCB bottom side

The pin names on the PCB differ from the diagram printed on the ST-Link/v2 enclosure.

After re-wiring, the blue ST-Link/v2 also worked as expected.

For the sake of completeness, here the correct pin-out:

Pin Row Name
1 Upper RST
3 Upper SWIM
5 Upper GND
7 Upper 3.3V
9 Upper 5.0V
2 Bottom SWCLK
4 Bottom SWDIO
6 Bottom GND
8 Bottom 3.3V
10 Bottom 5.0V

Bottom line

Out of curiosity, I checked Amazon, eBay, and a few of the Chinese trading platforms and to my surprise, almost all of the ST-Link/v2s shown have the wrong pin-out diagram printed on the enclosure. I hope that the manufactures will correct the diagram in the future. In the meanwhile, I hope this article was helpful and saved you from falling into the same trap 😜.

Источник

Error in initializing ST-Link Device — Failed to connect to device

I am currently using the ST-Link debugger to program my STM32F3 Discovery Board. The IDE that I am using is Atollic TrueStudio 5.5.2. Now I am facing a very weird problem which is I keep on getting the message

Error in initializing ST-Link Device. Reason : (-1) Failed to connect to device . Please check power and cabling to target.

whenever I want to download the program into my STM32. I have tried some solutions that I found from internet but the problem still exists. Has anyone faced this problems before? Any suggestions will help.

6 Answers 6

I had same situation on Ubuntu. I solved this, using STM32CubeProgrammer.

On the ST-LINK configuration area:

  1. Serial number -> refresh to get your stlink serial
  2. Mode: Under reset
  3. Reset mode: Core reset

try to connect asap when power your board. When you connect you can do «full chip erease». It suppose to be ready for next usage. I hope it helps

Not an expert in the whole PC stuff but I found out in windows 10 using external ST-LINK V2 from aliexpress that the PC machine might select the wrong driver per device by default and what you do to fix that is to simply change the corresponding driver for the device.

Here’s how you do it:

And that pretty much fixed all my problems.

You could try the following.

Make sure that you have installed the right version of the driver (32 or 64 bits).

If you are using an external ST-Link, make sure that you connect VCC, GND, RESET, SWDIO and SWDCLK.

If you are using an external ST-Link, make sure that Atollic is using the right one. You may have 2 ST-link connected (the external and the embedded one).

Ensure that the ST-Link is setup in SWD mode and not in JTAG.

In Atollic, you could also change how the ST-Link connects to your target. Try different combinations, for example Connect under hardware reset.

In the debugger tab, make sure to select SWD , not JTAG .

From the documentation of a Nucleo-144 board, it can be few problems:

Before connecting the Nucleo-144 board to a Windows® 7, Windows® 8 or Windows® 10 PC via USB, a driver for ST-LINK/V2-1 must be installed. It can be downloaded from the www.st.com website. In case the STM32 Nucleo-144 board is connected to the PC before installing the driver, the PC device manager may report some Nucleo interfaces as “Unknown”. To recover from this situation, after installing the dedicated driver, the association of “Unknown” USB devices found on the STM32 Nucleo-144 board to this dedicated driver, must be updated in the device manager manually It is recommended to proceed using USB Composite Device, as shown in the image

To program and debug the on-board STM32, place the two jumpers marked in red on the connector CN4, as shown in the image. The CN6 connector must not be used, since it could disturb the communication with the STM32 microcontroller of the Nucleo-144 board.

Источник

The board is a STEVAL-PTOOL1V1. The setup was tried on different boards.
The programmer board used is a STLINK-V3SET.

I followed the instructions on the Getting started document of the STEVAL-PTOOL1V1.

I power the board through J1 and J2 with a power supply supplying 12V.
I connected J8 with a jumper.
I connected the SWD pins to the STLINKS.

Here is the setup and the documentation for the SWD connector of the PTOOL1V1.
The pin at the bottom (with the red cable) is the first one. It has a square-shaped weld.

In order to communicate with the board, I tried:

Uploading the example project of the STEVAL-PTOOL1V1 by clicking on the debbuger icon of the CubeIDE

Clicking «Connect» in STM32CubeProgrammer

Clicking «Connect to the target» in STM32 ST-LINK Utility

Using the Open source version of the STMicroelectronics STLINK Tools : stlink

Here are the errors messages for each:

In STM32CubeProgrammer, I tried changing the configuration of the STLINK. The port is at SWD . I tried Hardware , Core and Software for the reset mode. I tried Normal , Under Reset and Hot plug for the mode. Same result with every configurations.

When the board is powered, I have a tension of 3.3V on the VDD of the SWD connector.

Any idea why the flashing process is not working ?

Источник

Error in initializing st link device reason no device found on target

Всем привет! Ребята, кричу HELP. Возникла проблема, с которой уже неделю сижу, никак не могу решить ее, что я только не делал.

В общем, купил я года так 3-4 назад stm32f103c8c6 у одного чувака, взял новый, но он их тоже с алиэкпресс, помойму, скупает.
И начал работать с этой платой. Работаю я в CubIDE, все прекрасно работало, писал себе проект. Потом этот микроконтроллер начал работать с косяками, начались какие-то мигания не нужные и тд и тп, я подумал что ему хана, не полностью, но хана. Заказал новые, и тут все началось! Они не прошиваются! Сначала заказал 2 штуки с алиэкспрес, не прашиваются, потом еще заказал и они тоже не прошиваются, выходит следующая ошибка:

«Error in final launch sequence:

Failed to start GDB server
Failed to start GDB server
Error in initializing ST-LINK device.
Reason: (18) Could not verify ST device! Abort connection.»

Но через утилиту «STM32 ST-LINK Utility» они все прошиваются! Без проблем!

Программатор ST-LINK V2 (китайский). Проблема скорее всего не внем, ведь первый микроконтроллер прошивается же. В утилите он тоже конектится:

Как я пытался решить эту проблему:
1)Были мысли, что в CubIDE есть защита от китайских микроконтроллеров, но ведь первый, который прошивается, он то тоже из китая. Но наверное это не так!

2) Делал «Firmware update» через утилиту «STM32 ST-LINK Utility»

3) В файле «stm32f1x.cfg» изменял «0x1ba01477» на «0x2ba01477»

4) Менял настройки на «ST-LINK(Open OCD)»

https://disk.yandex.ru/i/-bTJeWabcyBcUQ
Здесь я выложил документ, где полностью все расписано и имеются все фото, в том числе фото самих микроконтроллеров один из которых прошивается, другой нет, для визуальной оценки. Кот не позволяет здесь загружать фото больше 5 штук.

Я уже теряюсь в догадках, не знаю что и делать. Закупил 10 штук таких STM32, неужели мне их придется выкидывать, и забыть про эти бюджетные варинты и работать только с дорогими оригиналами? Кто сталкивался с этим подскажите пожалуйста.

Реклама
ART_ME
Собутыльник Кота

Карма: -22
Рейтинг сообщений: -38
Зарегистрирован: Вс окт 02, 2016 07:34:45
Сообщений: 2705
Рейтинг сообщения: 0

_________________
Никогда не спорьте с дураками. Они опустят Вас до своего уровня и победят за счет опыта.

Реклама

maksimdag0

Зарегистрирован: Чт апр 08, 2021 09:46:48
Сообщений: 137
Рейтинг сообщения: 0

Реклама

Сборка печатных плат от $30 + БЕСПЛАТНАЯ доставка по всему миру + трафарет

4airy
Родился

Зарегистрирован: Вс июл 24, 2022 11:42:22
Сообщений: 7
Рейтинг сообщения: 0

Добрый день.
Во-первых, в вкладке «Debugger», в поле «Reset behaviour» поставьте тип «Connect under reset».
Во-вторых, подключите пин Reset на STM к ST-LINK.
В-третьих, все остальные настройки верните в состояние по умолчанию.

UPD:
Попробуйте так же, поставить «Disable» в поле «Debug in low modes» (но сначала выполните описанные выше действия и протестируйте).

Реклама

Линейка изолированных DC/DC-преобразователей VCB и VCF с диапазоном мощности 3…400 Вт предназначена для использования в телекоммуникационной аппаратуре. Эти новые преобразователи третьего поколения (R3) выпускаются в типоразмерах SIP, 1/4 Brick, 1/8 Brick и 1/16 Brick. Данные DC/DC отвечают требованиям стандарта DOSA, имеют диапазон входного напряжения 2:1 (36…75 В), обладают высокой эффективностью (КПД до 93%) и широким температурным диапазоном -40…85ºС. Изоляция «вход-выход» составляет 1500/2250 В. VCB и VCF выпускаются в двух вариантах по логике управления: N (отрицательной) и P (положительной).

ART_ME
Собутыльник Кота

Карма: -22
Рейтинг сообщений: -38
Зарегистрирован: Вс окт 02, 2016 07:34:45
Сообщений: 2705
Рейтинг сообщения: 0

_________________
Никогда не спорьте с дураками. Они опустят Вас до своего уровня и победят за счет опыта.

Реклама
Реклама

В промышленных устройствах и установках с электроприводом на двигателях постоянного тока в момент пуска требуется обеспечить повышенный ток. Для решения этой задачи MEAN WELL предлагает вместо ИП с повышенной избыточной мощностью, более оптимальное решение — источник питания с необходимой перегрузочной способностью семейства HRP/N3. Новое семейство, представленное в Компэл, экономичнее и расширяет уже существующее HRP/N в увеличении кратности перегрузки.

maksimdag0

Зарегистрирован: Чт апр 08, 2021 09:46:48
Сообщений: 137
Рейтинг сообщения: 0

Добрый день.
Во-первых, в вкладке «Debugger», в поле «Reset behaviour» поставьте тип «Connect under reset».
Во-вторых, подключите пин Reset на STM к ST-LINK.
В-третьих, все остальные настройки верните в состояние по умолчанию.

UPD:
Попробуйте так же, поставить «Disable» в поле «Debug in low modes» (но сначала выполните описанные выше действия и протестируйте).

Добрый вечер! Выполнил все как написали, к сожалению все та же ошибка вылезает. Не понимаю в чем может быть причина?! Я где прочел, что было такое, заказали как-то партию stm и они тоже все не прошивались

Добавлено after 35 seconds:

Мурик
Друг Кота

Карма: 1
Рейтинг сообщений: 157
Зарегистрирован: Пн окт 11, 2010 19:00:08
Сообщений: 3311
Рейтинг сообщения: 0

Asmodey
Говорящий с текстолитом

Карма: 13
Рейтинг сообщений: 262
Зарегистрирован: Сб янв 28, 2006 22:47:24
Сообщений: 1582
Рейтинг сообщения: 0

_________________
Астролябия-сама меряет, было бы что мерять.

4airy
Родился

Зарегистрирован: Вс июл 24, 2022 11:42:22
Сообщений: 7
Рейтинг сообщения: 0

maksimdag0

Зарегистрирован: Чт апр 08, 2021 09:46:48
Сообщений: 137
Рейтинг сообщения: 0

Пробовал, без толку

Добавлено after 1 minute 33 seconds:

MLX90640

Карма: 12
Рейтинг сообщений: 182
Зарегистрирован: Ср авг 03, 2022 05:22:56
Сообщений: 744
Рейтинг сообщения: 0

Asmodey
Говорящий с текстолитом

Карма: 13
Рейтинг сообщений: 262
Зарегистрирован: Сб янв 28, 2006 22:47:24
Сообщений: 1582
Рейтинг сообщения: 0

_________________
Астролябия-сама меряет, было бы что мерять.

HardWareMan
Открыл глаза

Зарегистрирован: Ср сен 02, 2015 07:47:20
Сообщений: 42
Рейтинг сообщения: 0

Так ведь есть же выход сброса у SWD программатора. Подключить его тоже и включить «connect under reset».

Что касается непонятного поведения контроллера с Алишечки даже если пытаешься просто помигать светодиодом скажу так: там они все БУ. Найти новый и до пандемии было сложно, а сейчас просто невозможно. У многих из них опции прописаны и в них часто включён сторожевой пёс. Именно такая проблема была чаще всего: если твой контроллер начинает «чудить» особенно со временем — напиши простенькую программку, которая приведёт его опции в исходный заводской вид. Из полусотни контроллеров с Алишечки, что прошли мимо меня, мне пришлось обнулять примерно 2/3. Напомню, что программатором стереть опции нельзя, только ядро может их крутить. Ну и не залочте там случайно RDP.

MLX90640

Карма: 12
Рейтинг сообщений: 182
Зарегистрирован: Ср авг 03, 2022 05:22:56
Сообщений: 744
Рейтинг сообщения: 0

Чой-то нельзя? Всё можно через утилиту ST-Link, полный контроль:

Включенный аппаратный вачдог будет сбрасывать микроконтроллер при работе приблизительно через каждые (если память не изменяет) 3 секунды. И отключить его можно только через биты опций. Лучше всего это делать через утилиту ST-Link, потому что программно можно напортачить до блокировки микроконтроллера. Хорошо, что у F1 серии блокировка только первого уровня, не полный «кирпич». У F1 рид-аут протекшн лечится просто снятием защиты через утилиту ст-линк, при этом прошивка будет стерта. А вот у более современных серий есть уже вариант Level-2, там уже — полный кирпич.

Мурик
Друг Кота

Карма: 1
Рейтинг сообщений: 157
Зарегистрирован: Пн окт 11, 2010 19:00:08
Сообщений: 3311
Рейтинг сообщения: 0

maksimdag0

Зарегистрирован: Чт апр 08, 2021 09:46:48
Сообщений: 137
Рейтинг сообщения: 0

Всем доброго дня! Не отвечал, потом что решал эту проблему, и решил ответить уже с результатом. Перепробовал все что вы предложили, все равно без результатно. Вывел с st-link reset и пытался подключиться с ним! Скачал Atollic, но тоже такая же ошибка. Сейчас установился keil (с официального сайта), хочу проверить на нем, и уже тогда будет 100% ясно в МК проблема или в IDE. Сгенерировал код с Cubmx, открываю проект в keil, компилю, а оно не компилится, вылезал такой текст:

«Build started: Project: HTT_EM
*** Target ‘Display_MIRT-687253-297_DP1_xxxx_x_U1P1_x_BLE6027K’ uses ARM-Compiler ‘Default Compiler Version 5’ which is not available.
*** Please review the installed ARM Compiler Versions:
‘Manage Project Items — Folders/Extensions’ to manage ARM Compiler Versions.
‘Options for Target — Target’ to select an ARM Compiler Version for the target.
*** Build aborted.
Build Time Elapsed: 00:00:00»

Решил эту проблему, изменив в настройках установку компилятора на “V6.18”:

После этого у меня вылезла новая ошибка:

«Build started: Project: Test_project
*** Using Compiler ‘V6.18’, folder: ‘C:Keil_v5ARMARMCLANGBin’
Build target ‘Test_project’
ArmClang: error: unable to execute command: Unable to convert command-line to UTF-16: Символ Юникода не имеет сопоставления в конечной многобайтовой кодовой странице. (0x459)
assembling startup_stm32f103xb.s.
«Test_projectTest_project.axf» — 1 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed: 00:00:00»

Долго над ней сидел, но так и не получилось ее решить. Из-за чего это ошибка, подскажите, знатоки?

Пробовал выбирать различные версии, но ошибка не исчезала.

Последний раз редактировалось maksimdag0 Вс авг 14, 2022 12:35:36, всего редактировалось 1 раз.

VladislavS
Поставщик валерьянки для Кота

Карма: 13
Рейтинг сообщений: 360
Зарегистрирован: Вт май 01, 2018 19:44:47
Сообщений: 2264
Рейтинг сообщения: 0

maksimdag0

Зарегистрирован: Чт апр 08, 2021 09:46:48
Сообщений: 137
Рейтинг сообщения: 0

Вложения:
название компьютера.png [63.04 KiB]
Скачиваний: 45
путь проекта.png [31.1 KiB]
Скачиваний: 48
Вернуться наверх
MLX90640

Карма: 12
Рейтинг сообщений: 182
Зарегистрирован: Ср авг 03, 2022 05:22:56
Сообщений: 744
Рейтинг сообщения: 0

Хотя, у меня, например, имя пользователя — тоже русскими буквами, но проблем с работой не было.

А к целевому микроконтроллеру через утилиту ST-Link удается подключиться? Если да, то выберите Target->Option Bytes и посмотрите, что там есть (как в приведенном мною выше скрине).

Добавлено after 6 minutes 38 seconds:
Ага, вижу, что через утилиту ST-Link у вас получается подключиться. Ну да, теперь откройте Target->Option Bytes и посмотрите, какие там галочки установлены или сброшены.
Кстати, 103C8 определяется с 256 кБ флеша? Ажно в 4 раза превысили. До 128 встречал, а тут аж 256. Он определяется как High-Density. Посмотрите еще раз маркировку на корпусе микросхемы через увеличитель. Возможно, как раз причина в том, что вы в проекте определяете его как C8, принадлежащий к Medium-Density, а он на самом деле из другой категории. А они как раз и различаются не только размерами флеша, но и прочей внутрянкой.

maksimdag0

Зарегистрирован: Чт апр 08, 2021 09:46:48
Сообщений: 137
Рейтинг сообщения: 0

Кстати, да. В STMке, которая прошивается она определяется в утилите ST-Link как 128kb, а в STMках, которые не прошиваются — 256kb. Это что получается-то? Другой микроконтроллер? (где-то я читал, у кого-то уже так было вроде, что написано одно, а оказались другие МК, но помоему человек заказывал STM32F103C8T6 а по факту стоял процессор STM32F103C6T6). У меня тогда какой, ведь STM32F103C6T6 не может быть на 256kb?

В ST-Link — STMка которая прошивается:

В ST-Link — STMки которые НЕ прошиваются:

Маркировка STMки которая прошивается:

Маркировка STMок которые НЕ прошиваются:

Часовой пояс: UTC + 3 часа

Кто сейчас на форуме

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 6

Источник

Adblock
detector

0 / 0 / 0

Регистрация: 22.04.2020

Сообщений: 23

1

31.03.2022, 15:35. Показов 2960. Ответов 50


Здравствуйте. Начал использовать плату NUCLEO STM32H745IQ. Проверяю на ней самые простые проекты, по типу переключения светодиода или использования таймера для прерывания. Для создания начального кода использую CubeMX. Но после прошивки скетча c считыванием АЦП, стало выдавать ошибку в CubeIDE для любого прошиваемого скетча (переключение светодиода и т.д.):

Target no device found

Error in initializing ST-LINK device.
Reason: No device found on target.

А в CubeProgrammer пишет это:

ST-LINK error (DEV_CONNECT_ERR)

Пробовал прошивать разными способами (различные режимы и программы, например, CubeProgrammer и ST-LINK Utility) и на разных платах (если быть точным на трёх платах NUCLEO STM32H745IQ и одной плате NUCLEO STM32F411RE, все оригинальные), но ничего в итоге не дало результата. Может проблема в самом CubeIDE (никаких начальных настроек в ней не производил)? Подскажите, пожалуйста, в чём может быть проблема.

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



Модератор

Эксперт по электронике

8759 / 6549 / 887

Регистрация: 14.02.2011

Сообщений: 22,972

31.03.2022, 22:43

2

Цитата
Сообщение от samurai_jke
Посмотреть сообщение

CubeIDE

попробуй STM32 ST-LINK Utility, может обновить нужно прошивку программатор.

Цитата
Сообщение от samurai_jke
Посмотреть сообщение

Target no device found

а в «диспетчере оборудование» что показывает?



0



68 / 60 / 11

Регистрация: 09.02.2016

Сообщений: 801

Записей в блоге: 15

01.04.2022, 07:03

3

Цитата
Сообщение от samurai_jke
Посмотреть сообщение

Проверяю на ней самые простые проекты, по типу переключения светодиода или использования таймера для прерывания

9 из 10- что вы затронули прошивкой пины SWD… скорее всего порт А последние пины (13, 14) (сам этого железа не имею, но симптомы схожи)

кода инициализации gpio вашего не вижу, поэтому точно сказать не могу..

делайте что нить не затрагивающее GPIOA и заливайте через usb (DFU) и будет вам счастье… или заливайте через SWD с RST (это я не пробовал, но кто то писал что так тоже работает)



0



0 / 0 / 0

Регистрация: 22.04.2020

Сообщений: 23

01.04.2022, 09:21

 [ТС]

4

попробуй STM32 ST-LINK Utility, может обновить нужно прошивку программатор.

Через ST-LINK Utility я пробовал прошивать и обновлять неоднократно (+чип через него стирал)



0



0 / 0 / 0

Регистрация: 22.04.2020

Сообщений: 23

01.04.2022, 09:33

 [ТС]

5

а в «диспетчере оборудование» что показывает?

В нём вроде всё нормально, виртуальный COM-порт и ST-LINK Debug определяется

Миниатюры

Ошибка инициализации ST-LINK
 



0



samurai_jke

0 / 0 / 0

Регистрация: 22.04.2020

Сообщений: 23

01.04.2022, 09:52

 [ТС]

6

Цитата
Сообщение от ВитГо
Посмотреть сообщение

9 из 10- что вы затронули прошивкой пины SWD… скорее всего порт А последние пины (13, 14) (сам этого железа не имею, но симптомы схожи)

Так и есть, но эти пины должны использоваться (по крайней мере так говорится в статьях и видео, по которым учусь)

Цитата
Сообщение от ВитГо
Посмотреть сообщение

кода инициализации gpio вашего не вижу, поэтому точно сказать не могу..

По сути, кроме самого АЦП, GPIO ничто не использует (прикреплю код на всякий случай)

Кликните здесь для просмотра всего текста

C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
/* Includes ------------------------------------------------------------------*/
#include "main.h"
 
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
int adc_value;
/* USER CODE END Includes */
 
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
 
/* USER CODE END PTD */
 
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
 
#ifndef HSEM_ID_0
#define HSEM_ID_0 (0U) /* HW semaphore 0*/
#endif
/* USER CODE END PD */
 
/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */
 
/* USER CODE END PM */
 
/* Private variables ---------------------------------------------------------*/
ADC_HandleTypeDef hadc1;
 
/* USER CODE BEGIN PV */
 
/* USER CODE END PV */
 
/* Private function prototypes -----------------------------------------------*/
static void MX_GPIO_Init(void);
static void MX_ADC1_Init(void);
/* USER CODE BEGIN PFP */
 
/* USER CODE END PFP */
 
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
 
/* USER CODE END 0 */
 
/**
  * @brief  The application entry point.
  * @retval int
  */
int main(void)
{
  /* USER CODE BEGIN 1 */
 
  /* USER CODE END 1 */
 
/* USER CODE BEGIN Boot_Mode_Sequence_1 */
  /*HW semaphore Clock enable*/
  __HAL_RCC_HSEM_CLK_ENABLE();
  /* Activate HSEM notification for Cortex-M4*/
  HAL_HSEM_ActivateNotification(__HAL_HSEM_SEMID_TO_MASK(HSEM_ID_0));
  /*
  Domain D2 goes to STOP mode (Cortex-M4 in deep-sleep) waiting for Cortex-M7 to
  perform system initialization (system clock config, external memory configuration.. )
  */
  HAL_PWREx_ClearPendingEvent();
  HAL_PWREx_EnterSTOPMode(PWR_MAINREGULATOR_ON, PWR_STOPENTRY_WFE, PWR_D2_DOMAIN);
  /* Clear HSEM flag */
  __HAL_HSEM_CLEAR_FLAG(__HAL_HSEM_SEMID_TO_MASK(HSEM_ID_0));
 
/* USER CODE END Boot_Mode_Sequence_1 */
  /* MCU Configuration--------------------------------------------------------*/
 
  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();
 
  /* USER CODE BEGIN Init */
 
  /* USER CODE END Init */
 
  /* USER CODE BEGIN SysInit */
 
  /* USER CODE END SysInit */
 
  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_ADC1_Init();
  /* USER CODE BEGIN 2 */
  HAL_ADCEx_Calibration_Start(&hadc1, ADC_CALIB_OFFSET, ADC_SINGLE_ENDED);
 
  /* USER CODE END 2 */
 
  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
 
    /* USER CODE END WHILE */
 
    /* USER CODE BEGIN 3 */
      HAL_ADC_Start(&hadc1);
      HAL_ADC_PollForConversion(&hadc1, 100);
      adc_value = HAL_ADC_GetValue(&hadc1);
      HAL_ADC_Stop(&hadc1);
      HAL_Delay(1000);
  }
  /* USER CODE END 3 */
}
 
/**
  * @brief ADC1 Initialization Function
  * @param None
  * @retval None
  */
static void MX_ADC1_Init(void)
{
 
  /* USER CODE BEGIN ADC1_Init 0 */
 
  /* USER CODE END ADC1_Init 0 */
 
  ADC_MultiModeTypeDef multimode = {0};
  ADC_ChannelConfTypeDef sConfig = {0};
 
  /* USER CODE BEGIN ADC1_Init 1 */
 
  /* USER CODE END ADC1_Init 1 */
  /** Common config
  */
  hadc1.Instance = ADC1;
  hadc1.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV1;
  hadc1.Init.Resolution = ADC_RESOLUTION_16B;
  hadc1.Init.ScanConvMode = ADC_SCAN_DISABLE;
  hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
  hadc1.Init.LowPowerAutoWait = DISABLE;
  hadc1.Init.ContinuousConvMode = DISABLE;
  hadc1.Init.NbrOfConversion = 1;
  hadc1.Init.DiscontinuousConvMode = DISABLE;
  hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START;
  hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
  hadc1.Init.ConversionDataManagement = ADC_CONVERSIONDATA_DR;
  hadc1.Init.Overrun = ADC_OVR_DATA_PRESERVED;
  hadc1.Init.LeftBitShift = ADC_LEFTBITSHIFT_NONE;
  hadc1.Init.OversamplingMode = DISABLE;
  if (HAL_ADC_Init(&hadc1) != HAL_OK)
  {
    Error_Handler();
  }
  /** Configure the ADC multi-mode
  */
  multimode.Mode = ADC_MODE_INDEPENDENT;
  if (HAL_ADCEx_MultiModeConfigChannel(&hadc1, &multimode) != HAL_OK)
  {
    Error_Handler();
  }
  /** Configure Regular Channel
  */
  sConfig.Channel = ADC_CHANNEL_15;
  sConfig.Rank = ADC_REGULAR_RANK_1;
  sConfig.SamplingTime = ADC_SAMPLETIME_1CYCLE_5;
  sConfig.SingleDiff = ADC_SINGLE_ENDED;
  sConfig.OffsetNumber = ADC_OFFSET_NONE;
  sConfig.Offset = 0;
  sConfig.OffsetSignedSaturation = DISABLE;
  if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN ADC1_Init 2 */
 
  /* USER CODE END ADC1_Init 2 */
 
}
 
/**
  * @brief GPIO Initialization Function
  * @param None
  * @retval None
  */
static void MX_GPIO_Init(void)
{
 
  /* GPIO Ports Clock Enable */
  __HAL_RCC_GPIOA_CLK_ENABLE();
 
}
 
/* USER CODE BEGIN 4 */
 
/* USER CODE END 4 */
 
/**
  * @brief  This function is executed in case of error occurrence.
  * @retval None
  */
void Error_Handler(void)
{
  /* USER CODE BEGIN Error_Handler_Debug */
  /* User can add his own implementation to report the HAL error return state */
  __disable_irq();
  while (1)
  {
  }
  /* USER CODE END Error_Handler_Debug */
}
 
#ifdef  USE_FULL_ASSERT
/**
  * @brief  Reports the name of the source file and the source line number
  *         where the assert_param error has occurred.
  * @param  file: pointer to the source file name
  * @param  line: assert_param error line source number
  * @retval None
  */
void assert_failed(uint8_t *file, uint32_t line)
{
  /* USER CODE BEGIN 6 */
  /* User can add his own implementation to report the file name and line number,
     ex: printf("Wrong parameters value: file %s on line %drn", file, line) */
  /* USER CODE END 6 */
}
#endif /* USE_FULL_ASSERT */

Цитата
Сообщение от ВитГо
Посмотреть сообщение

делайте что нить не затрагивающее GPIOA и заливайте через usb (DFU) и будет вам счастье… или заливайте через SWD с RST (это я не пробовал, но кто то писал что так тоже работает)

Нужно будет попробовать через DFU, спасибо за подсказку. Я пробовал прошить через UART (использовав переходник USB2TTL и программу STMFlashLoader), но тоже не помогло (Выдает ошибку, как на втором скриншоте).

Миниатюры

Ошибка инициализации ST-LINK
 

Ошибка инициализации ST-LINK
 



0



68 / 60 / 11

Регистрация: 09.02.2016

Сообщений: 801

Записей в блоге: 15

01.04.2022, 14:26

7

Цитата
Сообщение от samurai_jke
Посмотреть сообщение

Так и есть, но эти пины должны использоваться (по крайней мере так говорится в статьях и видео, по которым учусь)

ну вот и представьте — чтобы работал ст линк эти пины должны быть настроены по умолчанию… посмотрите в референсе там указан moder GPIOA (и GPIOB — но он вас не коснулся пока :-)
вы изменили moder — пин от SWD отвалился — у вас отвалилась во первых возможность отладки !! (привет тому кто писал такой урок), ну и возможность программироваться через SWD…

я точно не помню, но помоему если соединить RST программатора и микроконтроллера — то когда поставите галочку Core Reset в настройках st-link может что и выйдет (то есть st-link сбросит микроконтроллер и начнет его программировать) — но это чисто предположение… больше ничего.. сам я не пробовал.. и когда доводил mcu до такого как у вас — просто через usb при помощи dfu перепрошивал на нормальную прошивку…

вообще PA13 PA14 стараюсь в своих прошивках не пользовать на этапе тестов.. это уж когда совсем ног не хватает.. а то без отладки бывает очень тяжело отлаживаться…

Добавлено через 7 минут

Цитата
Сообщение от samurai_jke
Посмотреть сообщение

По сути, кроме самого АЦП, GPIO ничто не использует (прикреплю код на всякий случай)

кроме включения тактирования gpioa не увидел кода настройки… ох уж этот куб…



0



0 / 0 / 0

Регистрация: 22.04.2020

Сообщений: 23

04.04.2022, 10:04

 [ТС]

8

Настроил пины PA13 и PA14 по умолчанию, но всё равно та же ошибка. Никаких дополнительных настроек делать не нужно?

Цитата
Сообщение от ВитГо
Посмотреть сообщение

кроме включения тактирования gpioa не увидел кода настройки… ох уж этот куб…

Тут скорее я виноват, а не куб. Прикрепил не тот код. Вот вроде бы нужный

Кликните здесь для просмотра всего текста

Код

/* Includes ------------------------------------------------------------------*/
#include "stm32h7xx_hal.h"

/** @addtogroup STM32H7xx_HAL_Driver
  * @{
  */

/** @defgroup GPIO  GPIO
  * @brief GPIO HAL module driver
  * @{
  */

#ifdef HAL_GPIO_MODULE_ENABLED

/* Private typedef -----------------------------------------------------------*/
/* Private defines ------------------------------------------------------------*/
/** @addtogroup GPIO_Private_Constants GPIO Private Constants
  * @{
  */

#if defined(DUAL_CORE)
#define EXTI_CPU1             (0x01000000U)
#define EXTI_CPU2             (0x02000000U)
#endif /*DUAL_CORE*/
#define GPIO_NUMBER           (16U)
/**
  * @}
  */
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
/** @defgroup GPIO_Exported_Functions GPIO Exported Functions
  * @{
  */

/** @defgroup GPIO_Exported_Functions_Group1 Initialization and de-initialization functions
 *  @brief    Initialization and Configuration functions
 *
@verbatim
 ===============================================================================
              ##### Initialization and de-initialization functions #####
 ===============================================================================
  [..]
    This section provides functions allowing to initialize and de-initialize the GPIOs
    to be ready for use.

@endverbatim
  * @{
  */

/**
  * @brief  Initializes the GPIOx peripheral according to the specified parameters in the GPIO_Init.
  * @param  GPIOx: where x can be (A..K) to select the GPIO peripheral.
  * @param  GPIO_Init: pointer to a GPIO_InitTypeDef structure that contains
  *         the configuration information for the specified GPIO peripheral.
  * @retval None
  */
void HAL_GPIO_Init(GPIO_TypeDef  *GPIOx, GPIO_InitTypeDef *GPIO_Init)
{
  uint32_t position = 0x00U;
  uint32_t iocurrent;
  uint32_t temp;
  EXTI_Core_TypeDef *EXTI_CurrentCPU;

#if defined(DUAL_CORE) && defined(CORE_CM4)
  EXTI_CurrentCPU = EXTI_D2; /* EXTI for CM4 CPU */
#else
  EXTI_CurrentCPU = EXTI_D1; /* EXTI for CM7 CPU */
#endif

  /* Check the parameters */
  assert_param(IS_GPIO_ALL_INSTANCE(GPIOx));
  assert_param(IS_GPIO_PIN(GPIO_Init->Pin));
  assert_param(IS_GPIO_MODE(GPIO_Init->Mode));

  /* Configure the port pins */
  while (((GPIO_Init->Pin) >> position) != 0x00U)
  {
    /* Get current io position */
    iocurrent = (GPIO_Init->Pin) & (1UL << position);

    if (iocurrent != 0x00U)
    {
      /*--------------------- GPIO Mode Configuration ------------------------*/
      /* In case of Output or Alternate function mode selection */
      if (((GPIO_Init->Mode & GPIO_MODE) == MODE_OUTPUT) || ((GPIO_Init->Mode & GPIO_MODE) == MODE_AF))
      {
        /* Check the Speed parameter */
        assert_param(IS_GPIO_SPEED(GPIO_Init->Speed));

        /* Configure the IO Speed */
        temp = GPIOx->OSPEEDR;
        temp &= ~(GPIO_OSPEEDR_OSPEED0 << (position * 2U));
        temp |= (GPIO_Init->Speed << (position * 2U));
        GPIOx->OSPEEDR = temp;

        /* Configure the IO Output Type */
        temp = GPIOx->OTYPER;
        temp &= ~(GPIO_OTYPER_OT0 << position) ;
        temp |= (((GPIO_Init->Mode & OUTPUT_TYPE) >> OUTPUT_TYPE_Pos) << position);
        GPIOx->OTYPER = temp;
      }

      if ((GPIO_Init->Mode & GPIO_MODE) != MODE_ANALOG)
      {
       /* Check the Pull parameter */
       assert_param(IS_GPIO_PULL(GPIO_Init->Pull));

      /* Activate the Pull-up or Pull down resistor for the current IO */
      temp = GPIOx->PUPDR;
      temp &= ~(GPIO_PUPDR_PUPD0 << (position * 2U));
      temp |= ((GPIO_Init->Pull) << (position * 2U));
      GPIOx->PUPDR = temp;
      }

      /* In case of Alternate function mode selection */
      if ((GPIO_Init->Mode & GPIO_MODE) == MODE_AF)
      {
        /* Check the Alternate function parameters */
        assert_param(IS_GPIO_AF_INSTANCE(GPIOx));
        assert_param(IS_GPIO_AF(GPIO_Init->Alternate));

        /* Configure Alternate function mapped with the current IO */
        temp = GPIOx->AFR[position >> 3U];
        temp &= ~(0xFU << ((position & 0x07U) * 4U));
        temp |= ((GPIO_Init->Alternate) << ((position & 0x07U) * 4U));
        GPIOx->AFR[position >> 3U] = temp;
      }

      /* Configure IO Direction mode (Input, Output, Alternate or Analog) */
      temp = GPIOx->MODER;
      temp &= ~(GPIO_MODER_MODE0 << (position * 2U));
      temp |= ((GPIO_Init->Mode & GPIO_MODE) << (position * 2U));
      GPIOx->MODER = temp;

      /*--------------------- EXTI Mode Configuration ------------------------*/
      /* Configure the External Interrupt or event for the current IO */
      if ((GPIO_Init->Mode & EXTI_MODE) != 0x00U)
      {
        /* Enable SYSCFG Clock */
        __HAL_RCC_SYSCFG_CLK_ENABLE();

        temp = SYSCFG->EXTICR[position >> 2U];
        temp &= ~(0x0FUL << (4U * (position & 0x03U)));
        temp |= (GPIO_GET_INDEX(GPIOx) << (4U * (position & 0x03U)));
        SYSCFG->EXTICR[position >> 2U] = temp;

        /* Clear Rising Falling edge configuration */
        temp = EXTI->RTSR1;
        temp &= ~(iocurrent);
        if ((GPIO_Init->Mode & TRIGGER_RISING) != 0x00U)
        {
          temp |= iocurrent;
        }
        EXTI->RTSR1 = temp;

        temp = EXTI->FTSR1;
        temp &= ~(iocurrent);
        if ((GPIO_Init->Mode & TRIGGER_FALLING) != 0x00U)
        {
          temp |= iocurrent;
        }
        EXTI->FTSR1 = temp;

        temp = EXTI_CurrentCPU->EMR1;
        temp &= ~(iocurrent);
        if ((GPIO_Init->Mode & EXTI_EVT) != 0x00U)
        {
          temp |= iocurrent;
        }
        EXTI_CurrentCPU->EMR1 = temp;

        /* Clear EXTI line configuration */
        temp = EXTI_CurrentCPU->IMR1;
        temp &= ~(iocurrent);
        if ((GPIO_Init->Mode & EXTI_IT) != 0x00U)
        {
          temp |= iocurrent;
        }
        EXTI_CurrentCPU->IMR1 = temp;
      }
    }

    position++;
  }
}

/**
  * @brief  De-initializes the GPIOx peripheral registers to their default reset values.
  * @param  GPIOx: where x can be (A..K) to select the GPIO peripheral.
  * @param  GPIO_Pin: specifies the port bit to be written.
  *          This parameter can be one of GPIO_PIN_x where x can be (0..15).
  * @retval None
  */
void HAL_GPIO_DeInit(GPIO_TypeDef  *GPIOx, uint32_t GPIO_Pin)
{
  uint32_t position = 0x00U;
  uint32_t iocurrent;
  uint32_t tmp;
  EXTI_Core_TypeDef *EXTI_CurrentCPU;

#if defined(DUAL_CORE) && defined(CORE_CM4)
  EXTI_CurrentCPU = EXTI_D2; /* EXTI for CM4 CPU */
#else
  EXTI_CurrentCPU = EXTI_D1; /* EXTI for CM7 CPU */
#endif

  /* Check the parameters */
  assert_param(IS_GPIO_ALL_INSTANCE(GPIOx));
  assert_param(IS_GPIO_PIN(GPIO_Pin));

  /* Configure the port pins */
  while ((GPIO_Pin >> position) != 0x00U)
  {
    /* Get current io position */
    iocurrent = GPIO_Pin & (1UL << position) ;

    if (iocurrent != 0x00U)
    {
      /*------------------------- EXTI Mode Configuration --------------------*/
      /* Clear the External Interrupt or Event for the current IO */
      tmp = SYSCFG->EXTICR[position >> 2U];
      tmp &= (0x0FUL << (4U * (position & 0x03U)));
      if (tmp == (GPIO_GET_INDEX(GPIOx) << (4U * (position & 0x03U))))
      {
        /* Clear EXTI line configuration for Current CPU */
        EXTI_CurrentCPU->IMR1 &= ~(iocurrent);
        EXTI_CurrentCPU->EMR1 &= ~(iocurrent);

        /* Clear Rising Falling edge configuration */
        EXTI->FTSR1 &= ~(iocurrent);
        EXTI->RTSR1 &= ~(iocurrent);

        tmp = 0x0FUL << (4U * (position & 0x03U));
        SYSCFG->EXTICR[position >> 2U] &= ~tmp;
      }

      /*------------------------- GPIO Mode Configuration --------------------*/
      /* Configure IO in Analog Mode */
      GPIOx->MODER |= (GPIO_MODER_MODE0 << (position * 2U));

      /* Configure the default Alternate Function in current IO */
      GPIOx->AFR[position >> 3U] &= ~(0xFU << ((position & 0x07U) * 4U)) ;

      /* Deactivate the Pull-up and Pull-down resistor for the current IO */
      GPIOx->PUPDR &= ~(GPIO_PUPDR_PUPD0 << (position * 2U));

      /* Configure the default value IO Output Type */
      GPIOx->OTYPER  &= ~(GPIO_OTYPER_OT0 << position) ;

      /* Configure the default value for IO Speed */
      GPIOx->OSPEEDR &= ~(GPIO_OSPEEDR_OSPEED0 << (position * 2U));
    }

    position++;
  }
}

/**
  * @}
  */

/** @defgroup GPIO_Exported_Functions_Group2 IO operation functions
 *  @brief GPIO Read, Write, Toggle, Lock and EXTI management functions.
 *
@verbatim
 ===============================================================================
                       ##### IO operation functions #####
 ===============================================================================

@endverbatim
  * @{
  */

/**
  * @brief  Reads the specified input port pin.
  * @param  GPIOx: where x can be (A..K) to select the GPIO peripheral.
  * @param  GPIO_Pin: specifies the port bit to read.
  *         This parameter can be GPIO_PIN_x where x can be (0..15).
  * @retval The input port pin value.
  */
GPIO_PinState HAL_GPIO_ReadPin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
{
  GPIO_PinState bitstatus;

  /* Check the parameters */
  assert_param(IS_GPIO_PIN(GPIO_Pin));

  if ((GPIOx->IDR & GPIO_Pin) != 0x00U)
  {
    bitstatus = GPIO_PIN_SET;
  }
  else
  {
    bitstatus = GPIO_PIN_RESET;
  }
  return bitstatus;
}

/**
  * @brief  Sets or clears the selected data port bit.
  *
  * @note   This function uses GPIOx_BSRR register to allow atomic read/modify
  *         accesses. In this way, there is no risk of an IRQ occurring between
  *         the read and the modify access.
  *
  * @param  GPIOx: where x can be (A..K) to select the GPIO peripheral.
  * @param  GPIO_Pin: specifies the port bit to be written.
  *          This parameter can be one of GPIO_PIN_x where x can be (0..15).
  * @param  PinState: specifies the value to be written to the selected bit.
  *          This parameter can be one of the GPIO_PinState enum values:
  *            @arg GPIO_PIN_RESET: to clear the port pin
  *            @arg GPIO_PIN_SET: to set the port pin
  * @retval None
  */
void HAL_GPIO_WritePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState)
{
  /* Check the parameters */
  assert_param(IS_GPIO_PIN(GPIO_Pin));
  assert_param(IS_GPIO_PIN_ACTION(PinState));

  if (PinState != GPIO_PIN_RESET)
  {
    GPIOx->BSRR = GPIO_Pin;
  }
  else
  {
    GPIOx->BSRR = (uint32_t)GPIO_Pin << GPIO_NUMBER;
  }
}

/**
  * @brief  Toggles the specified GPIO pins.
  * @param  GPIOx: Where x can be (A..K) to select the GPIO peripheral.
  * @param  GPIO_Pin: Specifies the pins to be toggled.
  * @retval None
  */
void HAL_GPIO_TogglePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
{
  uint32_t odr;

  /* Check the parameters */
  assert_param(IS_GPIO_PIN(GPIO_Pin));

  /* get current Output Data Register value */
  odr = GPIOx->ODR;

  /* Set selected pins that were at low level, and reset ones that were high */
  GPIOx->BSRR = ((odr & GPIO_Pin) << GPIO_NUMBER) | (~odr & GPIO_Pin);
}

/**
  * @brief  Locks GPIO Pins configuration registers.
  * @note   The locked registers are GPIOx_MODER, GPIOx_OTYPER, GPIOx_OSPEEDR,
  *         GPIOx_PUPDR, GPIOx_AFRL and GPIOx_AFRH.
  * @note   The configuration of the locked GPIO pins can no longer be modified
  *         until the next reset.
  * @param  GPIOx: where x can be (A..K) to select the GPIO peripheral for STM32H7 family
  * @param  GPIO_Pin: specifies the port bit to be locked.
  *         This parameter can be any combination of GPIO_PIN_x where x can be (0..15).
  * @retval None
  */
HAL_StatusTypeDef HAL_GPIO_LockPin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
{
  __IO uint32_t tmp = GPIO_LCKR_LCKK;

  /* Check the parameters */
  assert_param(IS_GPIO_LOCK_INSTANCE(GPIOx));
  assert_param(IS_GPIO_PIN(GPIO_Pin));

  /* Apply lock key write sequence */
  tmp |= GPIO_Pin;
  /* Set LCKx bit(s): LCKK='1' + LCK[15-0] */
  GPIOx->LCKR = tmp;
  /* Reset LCKx bit(s): LCKK='0' + LCK[15-0] */
  GPIOx->LCKR = GPIO_Pin;
  /* Set LCKx bit(s): LCKK='1' + LCK[15-0] */
  GPIOx->LCKR = tmp;
  /* Read LCKK register. This read is mandatory to complete key lock sequence*/
  tmp = GPIOx->LCKR;

  /* read again in order to confirm lock is active */
  if ((GPIOx->LCKR & GPIO_LCKR_LCKK) != 0x00U)
  {
    return HAL_OK;
  }
  else
  {
    return HAL_ERROR;
  }
}

/**
  * @brief  Handle EXTI interrupt request.
  * @param  GPIO_Pin: Specifies the port pin connected to corresponding EXTI line.
  * @retval None
  */
void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin)
{
#if defined(DUAL_CORE) && defined(CORE_CM4)
  if (__HAL_GPIO_EXTID2_GET_IT(GPIO_Pin) != 0x00U)
  {
    __HAL_GPIO_EXTID2_CLEAR_IT(GPIO_Pin);
    HAL_GPIO_EXTI_Callback(GPIO_Pin);
  }
#else
  /* EXTI line interrupt detected */
  if (__HAL_GPIO_EXTI_GET_IT(GPIO_Pin) != 0x00U)
  {
    __HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin);
    HAL_GPIO_EXTI_Callback(GPIO_Pin);
  }
#endif
}

/**
  * @brief  EXTI line detection callback.
  * @param  GPIO_Pin: Specifies the port pin connected to corresponding EXTI line.
  * @retval None
  */
__weak void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
  /* Prevent unused argument(s) compilation warning */
  UNUSED(GPIO_Pin);

  /* NOTE: This function Should not be modified, when the callback is needed,
           the HAL_GPIO_EXTI_Callback could be implemented in the user file
   */
}

/**
  * @}
  */


/**
  * @}
  */

#endif /* HAL_GPIO_MODULE_ENABLED */
/**
  * @}
  */

/**
  * @}
  */

И подскажите ещё, пожалуйста, с какими настройками лучше прошивать скетч

Миниатюры

Ошибка инициализации ST-LINK
 



0



68 / 60 / 11

Регистрация: 09.02.2016

Сообщений: 801

Записей в блоге: 15

04.04.2022, 16:03

9

не совсем понимаю код что вы приводите :-(

давайте сначала — при помощи dfu удалось оживить swd ? при помощи какой нить любой прошивки которая не портит эти пины… ?

я к сожалению не могу вам помочь с такой прошивкой потому что этот микроконтроллер просто не использую :-( для f4, f1 — сбросил бы вам такую прошивку (для заливки по dfu)…

Добавлено через 1 минуту

Цитата
Сообщение от samurai_jke
Посмотреть сообщение

Нужно будет попробовать через DFU

вам нужно dfu через usb (камень у вас жирный, так что по usb должна быть возможность записать прошивку)

Добавлено через 3 минуты
вот тема примерно аналогичная вашей, но там автор почему то не смог dfu запустить (есть сомнения в жизни камня, так как он там писал при питание по swd от 5 вольт… и больше инфы нет)

Как правильно прошить BlackPill

но все остальное у него очень похоже на ваши проблемы (перенастройка pa1314)



0



205 / 143 / 27

Регистрация: 14.02.2013

Сообщений: 1,086

04.04.2022, 17:44

10

У меня была такая проблема. Собираеш проект в HAL Cube и в нём конфгуришь вот так

Ошибка инициализации ST-LINK

на плате зажимаешь с начало кнопку reset потом не опуская ёё нажимаешь кнопку boot и прошиваешь.



0



68 / 60 / 11

Регистрация: 09.02.2016

Сообщений: 801

Записей в блоге: 15

04.04.2022, 20:20

11

Цитата
Сообщение от VladimirU
Посмотреть сообщение

на плате зажимаешь с начало кнопку reset потом не опуская ёё нажимаешь кнопку boot и прошиваешь.

вы бы дописали через что прошивать (usb swd), а то ответ опять на половину…



0



205 / 143 / 27

Регистрация: 14.02.2013

Сообщений: 1,086

04.04.2022, 21:23

12

Цитата
Сообщение от ВитГо
Посмотреть сообщение

вы бы дописали через что прошивать (usb swd), а то ответ опять на половину…

Наверное разобрался уже. На картинке подразумевается swd



0



399 / 73 / 7

Регистрация: 29.01.2018

Сообщений: 1,244

05.04.2022, 00:23

13

отличный у тебя MK. Шей для начала через stm32cubeprogrammer. опкатаешь, а потом уже……. и да st-flash не умеет с stm32H7. кто-бы что там не говорил. может через годит допилят. на гите была инфа вроде о том что вроде умеет, но кто-то писал на форуме, что сначала начали, а когда посмотрели что работы много, и за это никто не заплатит-бросили.



0



0 / 0 / 0

Регистрация: 22.04.2020

Сообщений: 23

05.04.2022, 15:23

 [ТС]

14

Цитата
Сообщение от ВитГо
Посмотреть сообщение

не совсем понимаю код что вы приводите :-(

Я привёл не тот код (это драйвер для gpio библиотеки HAL (1 скриншот), подумал вы это имеет ввиду).

Цитата
Сообщение от ВитГо
Посмотреть сообщение

давайте сначала — при помощи dfu удалось оживить swd ? при помощи какой нить любой прошивки которая не портит эти пины… ?

Через dfu не удалось, CubeProgrammer не видит плату, если пробовать подключать через usb(2 скриншот).

Миниатюры

Ошибка инициализации ST-LINK
 

Ошибка инициализации ST-LINK
 



0



0 / 0 / 0

Регистрация: 22.04.2020

Сообщений: 23

05.04.2022, 15:26

 [ТС]

15

Цитата
Сообщение от VladimirU
Посмотреть сообщение

на плате зажимаешь с начало кнопку reset потом не опуская ёё нажимаешь кнопку boot и прошиваешь.

Я пробовал так делать, только вместо кнопки boot(у меня её нет), соединял перемычкой пины boot0 и VDD(3.3V) и как видите, это не помогло



0



68 / 60 / 11

Регистрация: 09.02.2016

Сообщений: 801

Записей в блоге: 15

05.04.2022, 15:30

16

что то я вас не понимаю…
какой программер dfu ?

мы с вами точно об одном и том же говорим ?

ставите dfu demo tool с ней идут дрова… вот тут вроде есть ссылка http://wiki.amperka.ru/js:ide:dfu-firmware (а то не знаю пролезет ли в форум файл установки)

дальше сбрасываете плату кнопкой rst удерживая кнопку boot0 (ну или с перемычкой на + питания)…

микроконтроллер должен быть определен в виндовс как устройство
и потом через утилиту перепрошиваете…
нафиг все эти кубы.. вы уже при помощи куба зашли куда то — точно не туда…



0



68 / 60 / 11

Регистрация: 09.02.2016

Сообщений: 801

Записей в блоге: 15

05.04.2022, 15:42

17

вот что вы должны увидеть в итоге…

boot0 кстати надо держать после сброса.. старт иногда происходит с задержкой…

иногда может быть ошибка дескриптора — ну не знаю — кабель смените, платы руками не касайтесь…

Миниатюры

Ошибка инициализации ST-LINK
 



0



68 / 60 / 11

Регистрация: 09.02.2016

Сообщений: 801

Записей в блоге: 15

05.04.2022, 15:43

18

у утилиты есть дрова — в каталоге bindriver те что для win8.1 встают на 10-ку… я ставлю x64 дрова, там в папке есть exe для запуска



0



0 / 0 / 0

Регистрация: 22.04.2020

Сообщений: 23

05.04.2022, 15:57

 [ТС]

19

Цитата
Сообщение от ВитГо
Посмотреть сообщение

дальше сбрасываете плату кнопкой rst удерживая кнопку boot0 (ну или с перемычкой на + питания)…

Дело в том, что плата при подключении определяется, как составное устройство USB, а не STM Device in DFU Mode. Соответственно, DfuSe не видит контроллер и я не могу продвинуться дальше.
Может быть, я где-то запутался, но вроде всё делал, как в этой статье

Цитата
Сообщение от ВитГо
Посмотреть сообщение

http://wiki.amperka.ru/js:ide:dfu-firmware

Миниатюры

Ошибка инициализации ST-LINK
 

Ошибка инициализации ST-LINK
 



0



68 / 60 / 11

Регистрация: 09.02.2016

Сообщений: 801

Записей в блоге: 15

05.04.2022, 16:00

20

Цитата
Сообщение от samurai_jke
Посмотреть сообщение

как составное устройство USB

а драйвера то ставили ?
в папке с программой, посмотрите внимательно

у меня это путь C:Program Files (x86)STMicroelectronicsSoftwareDfuSe v3.0.5BinDriverWin8.1

не подключая устройство ставите драйвер запуском файла выделенного на скриншоте

потом подключаете и смотрите….

p.s. и старый драйвер я бы на всякий случай удалил на этом устройстве…

Миниатюры

Ошибка инициализации ST-LINK
 



0



IT_Exp

Эксперт

87844 / 49110 / 22898

Регистрация: 17.06.2006

Сообщений: 92,604

05.04.2022, 16:00

Помогаю со студенческими работами здесь

Ошибка инициализации
Доброго времени суток! У меня такая проблема, создал небольшой проект в windows forms, ну мой…

Ошибка инициализации
При такой инициализации вылезают ошибки:

error C2064: term does not evaluate to a function…

Ошибка инициализации
Помогите пожалуйста исправить ошибку в этой программе

#include &lt;iostream&gt;
using namespace std;…

Ошибка в инициализации
Пишет ошибка при инициализировании min Помогите, пожалуйста
#include &lt;iostream&gt;
#include…

Ошибка инициализации
Подскажите,пожалуйста. В чём могла быть ошибка…. Зарегистрировалась на форуме,который так же…

Ошибка инициализации
Ребята помогите пожалуйста.Программа компилируется удачно. А вот при работе, и при выборе функций…

Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:

20

right now I am trying to program on the STM32G0-Disco-board with the program stm32cubeide on WIN10.
This worked fine until it didn’t.
My problem right now is that I can’t debug/run it anymore. This is the first day I used this program, which doesn’t mean it didn’t worked at the beginning. Building, Debugging and Running worked just fine.
But now I get this error message:

Error in final launch sequence:

Failed to start GDB server
Failed to start GDB server
Error in initializing ST-LINK device.
Reason: (4) No device found on target.

I already tried multiple usb-ports, the jumper on the board. I even looked in this Batchfile:
C:STSTM32CubeIDE_1.3.0STM32CubeIDEpluginscom.st.stm32cube.ide.mcu.externaltools.stlink-gdb-server.win32_1.3.0.202002181050toolsbin
ST_LINK_gdbserver because it was mentioned in other threads and i just got this:

ERROR: Couldn’t locate STM32CubeProgrammer in ‘..STM32CubeProgrammerbin’, use -cp
GDB server exited.
And oh yeah i already looked into the device manager and everything looks good to me.

Help is much appreciated!

Comments

@TravJav

I have bought the blue pill STM32F103C8T6 using ST-LINK V.2. I have downloaded the required software to run ST-LINK V.2. So the issue I am having it that it appears the chip is not recognised when running st-util or any other st-* command.

When using the St-Link GUI on Arch Linux I can connect it seems but it appears the chip is a unknown device and Core = 0x0.

Using Atollic Studio and attempting to connect the debugger I am getting this output.


STMicroelectronics ST-LINK GDB server. Version 5.1.0
Copyright (c) 2018, STMicroelectronics. All rights reserved.

Starting server with the following options:
        Persistent Mode            : Disabled
        Logging Level              : 1
        Listen Port Number         : 61234
        Status Refresh Delay       : 15s
        Verbose Mode               : Disabled
        SWD Debug                  : Enabled

Target no device found

Error in initializing ST-LINK device.
Reason: No device found on target.

RUNNING $ st-util


^C[travjav@rey]: ~/Development/Invictus-board/STM32F103C8T6>$ st-util
st-util 1.5.1
2019-06-26T23:41:46 INFO usb.c: -- exit_dfu_mode
2019-06-26T23:41:46 INFO common.c: Loading device parameters....
2019-06-26T23:41:46 WARN common.c: Invalid flash type, please check device declaration
2019-06-26T23:41:46 INFO gdb-server.c: Chip ID is 00000000, Core ID is  00000000.
2019-06-26T23:41:46 INFO gdb-server.c: Listening at *:4242...

Running st-chipid
0x0000

in conclusion I am essentially not able to do anything and this is preventing me from setting up my environment. Should be noted, when plugging other ARM devices in and connecting them properly according to the datasheet I am getting the same error so something is missing in terms of libs or there must be some file that needs to be edited?

@xor-gate

When the original tooling of ST doesn’t work there must be some kind of hardware problem. And st-util does a readout and reads only zeroes. Which could be something wrong with SWD.

@TravJav

@xor-gate how do I proceed with my set up then?

@TravJav

and SWD? drivers you mean?

@TravJav

I believe you’re referring to one of the pins actually that are used by the St Link v2 programmer. Okay so if this is the case is there an alternative pin I can use that accomplishes the same function?

@Jochen0x90h

I have the very same setup. st-link —probe gives

 serial: 543f7106656754533850093f
openocd: "x54x3fx71x06x65x67x54x53x38x50x09x3f"
  flash: 65536 (pagesize: 1024)
   sram: 20480
 chipid: 0x0410
  descr: F1 Medium-density device

I can flash it using st-flash, but with st-util I get this error:

2019-06-27T18:26:58 INFO common.c: Attempting to write 1024 (0x400) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08000000 erased
2019-06-27T18:26:58 INFO common.c: Finished erasing 1 pages of 1024 (0x400) bytes
2019-06-27T18:26:58 INFO common.c: Starting Flash write for VL/F0/F3/F1_XL core id
2019-06-27T18:26:58 INFO flash_loader.c: Successfully loaded flash loader in sram

2019-06-27T18:26:58 INFO common.c: Starting verification of write complete
2019-06-27T18:26:58 INFO common.c: Flash written and verified! jolly good!
2019-06-27T18:26:58 INFO common.c: Attempting to write 1024 (0x400) bytes to stm32 address: 134218752 (0x8000400)
Flash page at addr: 0x08000400 erased
2019-06-27T18:26:58 INFO common.c: Finished erasing 1 pages of 1024 (0x400) bytes
2019-06-27T18:26:58 INFO common.c: Starting Flash write for VL/F0/F3/F1_XL core id
2019-06-27T18:26:58 INFO flash_loader.c: Successfully loaded flash loader in sram
2019-06-27T18:26:58 ERROR flash_loader.c: write error, count == 511
2019-06-27T18:26:58 ERROR common.c: stlink_flash_loader_run(0x8000400) failed! == -1
2019-06-27T18:26:58 ERROR gdb-server.c: cannot recv: -2

The cdcacm.c usb virtual com port example (https://github.com/libopencm3/libopencm3-examples/tree/master/examples/stm32/f1/stm32-h103/usb_cdcacm where LED changed to PC13) with loopback does not work though, I get this error in dmesg

[30770.719644] usb 1-10: new full-speed USB device number 30 using xhci_hcd
[30770.719807] usb 1-10: Device not responding to setup address.
[30770.927734] usb 1-10: Device not responding to setup address.
[30771.135665] usb 1-10: device not accepting address 30, error -71

My makefile is

DEVICE = STM32F103C8
OPENCM3_DIR = libopencm3
OBJS += cdcacm.o

CFLAGS += -Os -ggdb3
CPPFLAGS += -MD
LDFLAGS += -static -nostartfiles
LDLIBS += -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group

include $(OPENCM3_DIR)/mk/genlink-config.mk
include $(OPENCM3_DIR)/mk/gcc-config.mk

.PHONY: clean all

all: binary.elf binary.bin

clean:
	$(Q)$(RM) -rf binary.* *.o

include $(OPENCM3_DIR)/mk/genlink-rules.mk
include $(OPENCM3_DIR)/mk/gcc-rules.mk

@TravJav

I should also note when checking kernel messages with

$ dmesg | tail 
$[42220.561649] usb 1-2: Product: STM32 STLink
[42220.561651] usb 1-2: Manufacturer: STMicroelectronics
[42220.561653] usb 1-2: SerialNumber: UÿorfHH g
[42277.382320] usb 1-2: USB disconnect, device number 5
[42459.313228] usb 1-1: new full-speed USB device number 6 using xhci_hcd
[42459.454959] usb 1-1: New USB device found, idVendor=0483, idProduct=3748, bcdDevice= 1.00
[42459.454964] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[42459.454966] usb 1-1: Product: STM32 STLink
[42459.454969] usb 1-1: Manufacturer: STMicroelectronics
[42459.454971] usb 1-1: SerialNumber: UÿorfHH g

@TravJav

Results of running the below command

$ st-util -v99
st-util 1.5.1
2019-06-28T00:37:40 DEBUG common.c: stlink current mode: dfu
2019-06-28T00:37:40 INFO usb.c: -- exit_dfu_mode
2019-06-28T00:37:40 DEBUG common.c: *** stlink_exit_dfu_mode ***
2019-06-28T00:37:40 DEBUG common.c: stlink current mode: mass
2019-06-28T00:37:40 DEBUG common.c: *** stlink_enter_swd_mode ***
2019-06-28T00:37:40 DEBUG common.c: *** looking up stlink version
2019-06-28T00:37:40 DEBUG common.c: st vid         = 0x0483 (expect 0x0483)
2019-06-28T00:37:40 DEBUG common.c: stlink pid     = 0x3748
2019-06-28T00:37:40 DEBUG common.c: stlink version = 0x2
2019-06-28T00:37:40 DEBUG common.c: jtag version   = 0x21
2019-06-28T00:37:40 DEBUG common.c: swim version   = 0x7
2019-06-28T00:37:40 DEBUG common.c: *** stlink_jtag_reset ***
2019-06-28T00:37:40 DEBUG common.c: *** stlink_reset ***
2019-06-28T00:37:40 DEBUG common.c: *** stlink_write_debug32 5fa0004 to 0xe000ed0c
2019-06-28T00:37:40 INFO common.c: Loading device parameters....
2019-06-28T00:37:40 DEBUG common.c: *** stlink_core_id ***
2019-06-28T00:37:40 DEBUG common.c: core_id = 0x00000000
2019-06-28T00:37:40 DEBUG common.c: *** stlink_read_debug32 0 is 0xe0042000
2019-06-28T00:37:40 DEBUG common.c: *** stlink_read_debug32 0 is 0x40015800
2019-06-28T00:37:40 WARN common.c: Invalid flash type, please check device declaration
2019-06-28T00:37:40 DEBUG common.c: *** set_swdclk ***
2019-06-28T00:37:40 DEBUG common.c: *** stlink_reset ***
2019-06-28T00:37:40 DEBUG common.c: *** stlink_write_debug32 5fa0004 to 0xe000ed0c
2019-06-28T00:37:40 INFO gdb-server.c: Chip ID is 00000000, Core ID is  00000000.
2019-06-28T00:37:40 INFO gdb-server.c: Listening at *:4242..

AND
Results of running the below command

st-info --probe
Found 1 stlink programmers
 serial: 553f6f067266484820190467
openocd: "x55x3fx6fx06x72x66x48x48x20x19x04x67"
  flash: 0 (pagesize: 0)
   sram: 0
 chipid: 0x0000
  descr: unknown device

@TravJav

@xor-gate I think this board has r/w permissions do you have a command that can wipe the board so I may flash and debug it? the more I read the more I am convinced it’s showing symptoms of this, i’m just not familiar with the args that go in.

@Jochen0x90h

Have you tried to remove the cover of the st-link dongle that may touch the components inside? So remove it and then try st-info —probe agian. Also check if the soldering of the swclk and swdio pins is ok

@Jochen0x90h

I think I found the solution to your problem: I flashed an arduino bootloader (https://github.com/rogerclarkmelbourne/STM32duino-bootloader/blob/master/bootloader_only_binaries/generic_boot20_pc13.bin) and then I got the same output like you for st-info —probe. I then set the upper jumper to 1 to enable the intermal bootloader and thereby disable the arduino bootloader. Then st-info —probe looked normal again. I was able to flash the bootloader again, then changed the jumper back to 0. The arduino bootloader seems to work, no errors in dmesg and lsusb shows device 1eaf:0004, even after recompiling it with my installed gcc (6.3.1). I still have to find out why cdcacm.c does not work.

@TravJav

IMG_20190628_092715

@Jochen0x90h
Like this correct? I did this last night actually and noticed the green blinking light was not present anymore instead; it just had the solid red light. I ran the above commands again and it still can’t find the chip. Odd thing is I installed the needed software on my Mac as well and I end up with the same result on both machines.

@TravJav

also, plugging in my rasp pi to the correct connectors and another board yields the same error i described

@TravJav

when trying to flash using the procedure with st-flash I get this with the jumpers in the same position as the photo«`
[travjav@rey]: ~/Development/Invictus-
board/STM32F103C8T6>$ st-flash write main.bin 0x08000000
st-flash 1.5.1
2019-06-28T11:23:24 INFO common.c: Loading device parameters….
2019-06-28T11:23:24 WARN common.c: Invalid flash type, please check device declaration
core status: unknown
Unknown memory region
I sent above

@Jochen0x90h

The blinking light disappeared because now the internal serial bootloader (factory programmed) is now active. But if it didn’t do the trick then I unfortunately can’t help you. Did you remove the cover of the st-link dongle?

@TravJav

@TravJav

The blinking light disappeared because now the internal serial bootloader (factory programmed) is now active. But if it didn’t do the trick then I unfortunately can’t help you. Did you remove the cover of the st-link dongle?

Can you please clarify this: so moving the pins to the position shown in the last image I included, these need to remain in this position when debugging always? then can be put back to 0 position when the program is executing/ live?

@Jochen0x90h

The jumper can also be set back to 0 when debugging, it only has to be set to 1 if there is some program flashed that somehow prevents flasing over swd, for example by using these pins as output.
But great that you found the problem

@RockyF

I looked up a lot of information, and finally got the answer here. It was the reverse of the text of the boot jumper!
Thank you very much.
@TravJav @Jochen0x90h

@stlink-org
stlink-org

locked as resolved and limited conversation to collaborators

Apr 27, 2020

The board is a STEVAL-PTOOL1V1. The setup was tried on different boards.
The programmer board used is a STLINK-V3SET.

I followed the instructions on the Getting started document of the STEVAL-PTOOL1V1.

enter image description here

I power the board through J1 and J2 with a power supply supplying 12V.
I connected J8 with a jumper.
I connected the SWD pins to the STLINKS.

Here is the setup and the documentation for the SWD connector of the PTOOL1V1.
The pin at the bottom (with the red cable) is the first one. It has a square-shaped weld.

setup

documentation swd

In order to communicate with the board, I tried:

  • Uploading the example project of the STEVAL-PTOOL1V1 by clicking on the debbuger icon of the CubeIDE

  • Clicking «Connect» in STM32CubeProgrammer

  • Clicking «Connect to the target» in STM32 ST-LINK Utility

  • Using the Open source version of the STMicroelectronics STLINK Tools : stlink

Here are the errors messages for each:

STMicroelectronics ST-LINK GDB server. Version 5.9.1
Copyright (c) 2021, STMicroelectronics. All rights reserved.

Starting server with the following options:
Persistent Mode : Disabled
Logging Level : 1
Listen Port Number : 61234
Status Refresh Delay : 15s
Verbose Mode : Disabled
SWD Debug : Enabled
InitWhile : Enabled

Target no device found

Error in initializing ST-LINK device.
Reason: No device found on target.
09:04:16 : STM32CubeProgrammer API v2.8.0
09:21:46 : Warning: Device changed, refreshing...
09:21:46 : ST-LINK SN : 002C00343156501620323443
09:21:46 : ST-LINK FW : V3J8M3B5S1
09:21:46 : Board : STLINK-V3SET
09:21:46 : Voltage : 3.21V
09:21:46 : No STM32 target found!
09:21:46 : ST-LINK SN : 002C00343156501620323443
09:21:46 : ST-LINK FW : V3J8M3B5S1
09:21:46 : Board : STLINK-V3SET
09:21:46 : Voltage : 3.23V
09:21:46 : Error: No STM32 target found!
09:22:17 : Can not connect to target!
If you're trying to connect to an STM32W1xx device, please select Normal or HotPlug mode from Target->Settings menu.
If you're trying to connect to a low frequency application , please select a lower SWD Frequency mode from Target->Settings menu.
09:22:23 : No target connected
$ st-flash --connect-under-reset reset
st-flash 1.7.0
2021-10-11T14:54:45 INFO usb.c: Unable to match requested speed 1800 kHz, using 1000 kHz
2021-10-11T14:54:45 WARN common.c: NRST is not connected
2021-10-11T14:54:45 ERROR common.c: Can not connect to target. Please use 'connect under reset' and try again
Failed to connect to target

$ st-flash --freq=50 --connect-under-reset reset
st-flash 1.7.0
2021-10-11T14:54:39 WARN common.c: NRST is not connected
2021-10-11T14:54:40 ERROR common.c: Soft reset failed: timeout
2021-10-11T14:54:40 ERROR common.c: Can not connect to target. Please use 'connect under reset' and try again
Failed to connect to target

In STM32CubeProgrammer, I tried changing the configuration of the STLINK. The port is at SWD. I tried Hardware, Core and Software for the reset mode. I tried Normal, Under Reset and Hot plug for the mode. Same result with every configurations.

When the board is powered, I have a tension of 3.3V on the VDD of the SWD connector.

Any idea why the flashing process is not working ?

Понравилась статья? Поделить с друзьями:
  • Error in if argument is of length zero
  • Error in getting sensor data from amd adl library sensoring will be disabled перевод
  • Error in getting dual image active image configuration
  • Error in fun left invalid argument to unary operator
  • Error in final launch sequence failed to start gdb server