请问有哪位大佬有H750XB基于openocd的w25q256下载算法?我现在用clion+openocd环境,下载算法怎么写都报错,用反客群友的w25q64模板修改,总是出错
离线
离线
我的是w25q256的flash,模板用64改,也不行
离线
比较一下w25q64和w25q256的区别
离线
自己改改
source [find interface/stlink.cfg]
set CHIPNAME stm32h750vbt6
# enable stmqspi
if {![info exists QUADSPI]} {
set QUADSPI 1
}
source [find target/stm32h7x.cfg]
# QUADSPI initialization
proc qspi_init { } {
global a
mmw 0x580244E0 0x000007FF 0 ;# RCC_AHB4ENR |= GPIOAEN-GPIOKEN (enable clocks)
mmw 0x580244D4 0x00004000 0 ;# RCC_AHB3ENR |= QSPIEN (enable clock)
sleep 1 ;# Wait for clock startup
# PB06:AF10:H, PB02:AF09:H, PD13:AF09:H, PD12:AF09:H, PD11:AF09:H, PE02:AF09:H
# Port B: PB06:AF10:H, PB02:AF09:H
mmw 0x58020400 0x00002020 0x00001010 ;# MODER
mmw 0x58020408 0x00002020 0x00001010 ;# OSPEEDR
mmw 0x5802040C 0x00000000 0x00003030 ;# PUPDR
mmw 0x58020420 0x0A000900 0x05000600 ;# AFRL
# Port D: PD13:AF09:H, PD12:AF09:H, PD11:AF09:H
mmw 0x58020C00 0x0A800000 0x05400000 ;# MODER
mmw 0x58020C08 0x0A800000 0x05400000 ;# OSPEEDR
mmw 0x58020C0C 0x00000000 0x0FC00000 ;# PUPDR
mmw 0x58020C24 0x00999000 0x00666000 ;# AFRH
# Port E: PE02:AF09:H
mmw 0x58021000 0x00000020 0x00000010 ;# MODER
mmw 0x58021008 0x00000020 0x00000010 ;# OSPEEDR
mmw 0x5802100C 0x00000000 0x00000030 ;# PUPDR
mmw 0x58021020 0x00000900 0x00000600 ;# AFRL
# correct FSIZE is 0x16, however, this causes trouble when
# reading the last bytes at end of bank in *memory mapped* mode
# for single flash mode w25q64jv
;# 010101010000000000000 0 011000
mww 0x52005000 0x05500018 ;# QUADSPI_CR: PRESCALER=5, APMS=1, FTHRES=1, FSEL=0, DFM=0, SSHIFT=1, TCEN=1
mww 0x52005004 0x00160500 ;# QUADSPI_DCR: FSIZE=0x16, CSHT=0x05, CKMODE=0
;# FSIZE flash的大小。
mww 0x52005030 0x00001000 ;# QUADSPI_LPTR: deactivate CS after 4096 clocks when FIFO is full
;# 11010000000000 10 010100000011
mww 0x52005014 0x0D002503 ;# QUADSPI_CCR: FMODE=0x3, DMODE=0x1, DCYC=0x0, ADSIZE=0x2, ADMODE=0x1, IMODE=0x1
mmw 0x52005000 0x00000001 0 ;# QUADSPI_CR: EN=1
# Exit QPI mode
#mmw 0x52005000 0x00000002 0 ;# QUADSPI_CR: ABORT=1
#mww 0x52005014 0x000003F5 ;# QUADSPI_CCR: FMODE=0x0, DMODE=0x0, DCYC=0x0, ADSIZE=0x0, ADMODE=0x0, IMODE=0x3, INSTR=Exit QPI
sleep 1
# reset flash
mmw 0x52005000 0x00000002 0 ;# QUADSPI_CR: ABORT=1
mww 0x52005014 0x00000166 ;# QUADSPI_CCR: FMODE=0x0, DMODE=0x0, DCYC=0x0, ADSIZE=0x0, ADMODE=0x0, IMODE=0x1, INSTR=0x66
mww 0x52005014 0x00000199 ;# QUADSPI_CCR: FMODE=0x0, DMODE=0x0, DCYC=0x0, ADSIZE=0x0, ADMODE=0x0, IMODE=0x1, INSTR=0x99
# memory-mapped read mode with 3-byte addresses
mmw 0x52005000 0x00000002 0 ;# QUADSPI_CR: ABORT=1
;# 11 11 0 00100 00 11 10 11 01 11101011
mww 0x52005014 0x0F10EDEB ;# QUADSPI_CCR: FMODE=0x3, DMODE=0x3, DCYC=0x4, ADSIZE=0x2, ADMODE=0x3, IMODE=0x1, INSTR=READ
;mww 0x52005014 0x0D002503
}
$_CHIPNAME.cpu0 configure -event reset-init {
global QUADSPI
mmw 0x52002000 0x00000004 0x0000000B ;# FLASH_ACR: 4 WS for 192 MHZ HCLK
mmw 0x58024400 0x00000001 0x00000018 ;# RCC_CR: HSIDIV=1, HSI on
mmw 0x58024410 0x10000000 0xEE000007 ;# RCC_CFGR: MCO2=system, MCO2PRE=8, HSI as system clock
mww 0x58024418 0x00000040 ;# RCC_D1CFGR: D1CPRE=1, D1PPRE=2, HPRE=1
mww 0x5802441C 0x00000440 ;# RCC_D2CFGR: D2PPRE2=2, D2PPRE1=2
mww 0x58024420 0x00000040 ;# RCC_D3CFGR: D3PPRE=2
mww 0x58024428 0x00000040 ;# RCC_PPLCKSELR: DIVM3=0, DIVM2=0, DIVM1=4, PLLSRC=HSI
mmw 0x5802442C 0x0001000C 0x00000002 ;# RCC_PLLCFGR: PLL1RGE=8MHz to 16MHz, PLL1VCOSEL=wide
mww 0x58024430 0x01070217 ;# RCC_PLL1DIVR: 192 MHz: DIVR1=2, DIVQ=8, DIVP1=2, DIVN1=24
mmw 0x58024400 0x01000000 0 ;# RCC_CR: PLL1ON=1
sleep 1
mmw 0x58024410 0x00000003 0 ;# RCC_CFGR: PLL1 as system clock
sleep 1
adapter speed 4000
if { $QUADSPI } {
qspi_init
}
}
离线
比较一下w25q64和w25q256的区别
试了w25q64,修改了引脚,烧录一次成功后,后面就烧录不了了,用测试qspi程序能读写flash,就是烧录不了,不知道为什么。下面是openocd的烧录信息:
Info : The selected transport took over low-level target control. The results mi
ght differ compared to plain JTAG/SWD
Info : clock speed 1800 kHz
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Info : STLINK V2J43S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.214708
Info : [stm32h750xbh6.cpu0] Cortex-M7 r1p1 processor detected
Info : [stm32h750xbh6.cpu0] target has 8 breakpoints, 4 watchpoints
Info : gdb port disabled
[stm32h750xbh6.cpu0] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080015d4 msp: 0x24080000
Info : Unable to match requested speed 24000 kHz, using 4000 kHz
Info : Unable to match requested speed 24000 kHz, using 4000 kHz
** Programming Started **
Info : Device: STM32H74x/75x
Info : flash size probed value 128k
Info : STM32H7 flash has a single bank
Info : Bank (0) size is 128 kb, base address is 0x08000000
Info : No id from flash1
Info : No id - set flash parameters manually
Info : No id from flash1
Info : No id - set flash parameters manually
Info : No id from flash1
Info : No id - set flash parameters manually
Error: Bank is invalid
embedded:startup.tcl:1467: Error: ** Programming Failed **
in procedure 'program'
in procedure 'program_error' called at file "embedded:startup.tcl", line 1532
at file "embedded:startup.tcl", line 1467
离线
@表慌张
现在我用的w25q64,使用您这个.cfg,我改成我板子的引脚,也报错,qspi flash可以确定是没有硬件问题的
libusb1 09e75e98b4d9ea7909e8837b7a3f00dda4589dc3
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override u
se 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results mi
ght differ compared to plain JTAG/SWD
Info : clock speed 1800 kHz
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Info : STLINK V2J43S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.211024
Info : [stm32h750vbt6.cpu0] Cortex-M7 r1p1 processor detected
Info : [stm32h750vbt6.cpu0] target has 8 breakpoints, 4 watchpoints
Info : gdb port disabled
[stm32h750vbt6.cpu0] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x080015d4 msp: 0x24080000
** Programming Started **
Info : Device: STM32H74x/75x
Info : flash size probed value 128k
Info : STM32H7 flash has a single bank
Info : Bank (0) size is 128 kb, base address is 0x08000000
Info : No id from flash1
Info : No id - set flash parameters manually
Info : No id from flash1
Info : No id - set flash parameters manually
Info : No id from flash1
Info : No id - set flash parameters manually
Error: Bank is invalid
embedded:startup.tcl:1467: Error: ** Programming Failed **
in procedure 'program'
in procedure 'program_error' called at file "embedded:startup.tcl", line 1532
at file "embedded:startup.tcl", line 1467
离线
要对照你的程序改cfg里的时钟,qspi等相关的配置
离线
第一次成功,后面不成功,我好像在哪看到过,说是flash的烧写寄存器值被修改了,被改成不能烧录了,需要重新把寄存器的值重置后,才可以
离线
第一次成功,后面不成功,我好像在哪看到过,说是flash的烧写寄存器值被修改了,被改成不能烧录了,需要重新把寄存器的值重置后,才可以
是哪个寄存器?
离线
bigniudiy 说:第一次成功,后面不成功,我好像在哪看到过,说是flash的烧写寄存器值被修改了,被改成不能烧录了,需要重新把寄存器的值重置后,才可以
是哪个寄存器?
有可能是状态寄存器里的QE位被使能了,就是第一次烧录之后,那个下载算法,顺手把QE位使能了,而且是掉电不丢失的那个位。导致下一次上电,flash默认就是按照QSPI模式工作。但是下载算法本身可能还是遵循SPI模式在下载。
离线
Info : No id from flash1
Info : No id - set flash parameters manually
不知道这是什么原因
离线