2

(I put links in my question but I will explain in as much detail what my problem is so that you won't need to use the links, they are just for reference) Hi,

I am trying to follow this youtube tutorial (https://www.youtube.com/watch?v=R6SstBoXjKc&list=PL6PplMTH29SHgRPDufZhfMRoFwRAIrzOp), but he uses coocox IDE and windows. I am using VS Code and Ubuntu 16.04.4 LTS. I am trying to use the platformio extension for VS Code along with an stlink-v2 and a bare stm32 f030r8t6 microcontroller(https://www.newbiehack.com/categories/newbiehack-microcontroller-ARM-stmicro-STM32F0R6-withBreadboardInterface). To connect my laptop to the board I use the st-util command which gives the following output:

    st-util 1.4.0-40-g1ec89bf
2018-07-12T21:28:36 INFO common.c: Loading device parameters....
2018-07-12T21:28:36 WARN common.c: Invalid flash type, please check device declaration
2018-07-12T21:28:36 INFO gdb-server.c: Chip ID is 00000000, Core ID is  00000000.
2018-07-12T21:28:36 INFO gdb-server.c: Listening at *:4242...

My platform.ini file is:

[env:f030r8t6]
platform = ststm32
board = f030r8t6
framework = stm32cube

And I created a custom config file called f030r8t6.json:

{
  "build": {
    "cpu": "cortex-m0",
    "extra_flags": "-DSTM32F030x8",
    "f_cpu": "48000000L",
    "mcu": "stm32f030r8t6"
  },
  "debug": {
    "default_tools": [
      "stlink"
    ],
    "openocd_target": "stm32f0x",
    "svd_path": "STM32F030.svd"
  },
  "frameworks": [
    "mbed",
    "stm32cube"
  ],
  "name": "ST STM32F030r8t6",
  "upload": {
    "maximum_ram_size": 8192,
    "maximum_size": 65536,
    "protocol": "stlink",
    "protocols": [
      "jlink",
      "stlink",
      "blackmagic"
    ]
  },
  "url": "http://www.st.com/en/evaluation-tools/32f0308discovery.html",
  "vendor": "ST"
}

When I build the project everything works fine, but when I try to upload I get the following:

Processing f030r8t6 (platform: ststm32; board: f030r8t6; framework: stm32cube)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: ST STM32 > ST STM32F030r8t6
SYSTEM: STM32F030R8T6 48MHz 8KB RAM (64KB Flash)
DEBUG: CURRENT(stlink) EXTERNAL(blackmagic, jlink, stlink)
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 0 compatible libraries
Scanning dependencies...
No dependencies
Checking size .pioenvs/f030r8t6/firmware.elf
DATA:    [          ]   0.3% (used 28 bytes from 8192 bytes)
PROGRAM: [          ]   0.7% (used 484 bytes from 65536 bytes)
Configuring upload protocol...
AVAILABLE: blackmagic, jlink, stlink
CURRENT: upload_protocol = stlink
Uploading .pioenvs/f030r8t6/firmware.elf
GNU MCU Eclipse 64-bits Open On-Chip Debugger 0.10.0+dev-00392-gbe9ef0b0 (2018-01-12-14:56)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
hla_swd
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
in procedure 'program'
in procedure 'init' called at file "embedded:startup.tcl", line 495
in procedure 'ocd_bouncer'
** OpenOCD init failed **
shutdown command invoked

*** [upload] Error 1
=================================================================== [ERROR] Took 0.84 seconds ===================================================================
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.

I've been stuck on this for weeks, and any help is really appreciated! Thank you!

Bzeeno
  • 23
  • 1
  • 4

1 Answers1

0

I guess you turned off JTAG and SW in your code when gpio primary remap. when I code stm32 with libOpenCM3 framework, code like this: gpio_primary_remap(AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_OFF, AFIO_MAPR_CAN1_REMAP_PORTB); will cause the issue like yours.

ninja
  • 1