采用STM32H7A3的MCU,主频设置为192MHz,跑rt-thread系统。代码在闪存下运行,软件功能正常,能够从外挂的spi flash的文件系统(littlefs)中播放wav和mp3文件。led灯闪烁正常。 这颗MCU的RAM比较,单AXI SRAM就有1MB,为了方便调试(内部闪存下载速率比较慢),考虑将代码置于sram中运行。进行如下步骤操作: 设置BOOT_ADD1[15:0] 为0x24000000 lds脚本,设置 ROM (rx) 0x24000000 512K, RAM (rw) 0x24080000 512K 代码中关闭MPU、ICache、DCache。 开启中断向量表偏移 #define VECT_TAB_SRAM 硬件上拉BOOT引脚
板子上电后,能够正常启动,LED灯闪烁正常。 但是在播放wav时,随机出现spi transfer error : 1,并在出错是产生噪音。 播放mp3文件时,产生严重的噪声,此时通过cpuu查看占用率cpu: 18。
开启MPU和DCache后,重新运行,led灯闪烁正常,播放wav正常。播放mp3文件时,还是存在严重的噪声。 请问是否操作步骤上有问题?把代码放置到ram中调试需要注意哪些细节? \ | /
- RT - Thread Operating System
/ | \ 4.1.0 build Aug 26 2022 10:51:04
2006 - 2022 Copyright by RT-Thread team
[251] I/SFUD: Find a Winbond flash chip. Size is 16777216 bytes.
[258] I/SFUD: norflash0 flash device is initialize success.
[264] I/SFUD: Probe SPI flash norflash0 by SPI device spi40 success.
[D/FAL] (fal_flash_init:49) Flash device | norflash0 | addr: 0x00000000 | len: 0x01000000 | blk_size: 0x00001000 |initialized finish.
[I/FAL] ==================== FAL partition table ====================
[I/FAL] | name | flash_dev | offset | length |
[I/FAL] -------------------------------------------------------------
[I/FAL] | easyflash | norflash0 | 0x00000000 | 0x00100000 |
[I/FAL] | filesystem | norflash0 | 0x00100000 | 0x00f00000 |
[I/FAL] =============================================================
[I/FAL] RT-Thread Flash Abstraction Layer initialize success.
[332] D/main: Systemclock : 192000000Hz
[I/FAL] The FAL block device (filesystem) created successfully
[343] D/main: Create a block device on the filesystem partition of flash successful.
[353] I/main: Filesystem initialized!
msh />found part[0], begin: 16384, size: 1.895GB
ls
Directory /:
udisk <DIR>
k1.mp3 2602271
2.wav 6737036
msh />wavplay -s 2.wav
[18494] I/WAV_PLAYER: play start, uri=2.wav
msh />[19744] I/drv.spi: spi transfer error : 1
[31743] I/drv.spi: spi transfer error : 1
[32748] I/drv.spi: spi transfer error : 1
[42730] I/drv.spi: spi transfer error : 1
[43735] I/drv.spi: spi transfer error : 1
[67744] I/drv.spi: spi transfer error : 1
[88674] I/WAV_PLAYER: play end
msh />mp3play -s k1.mp3
[1015200] I/mp3 player: play start, uri=k1.mp3
------------MP3 INFO------------
Title?) [Live]
Artist?)
Year?) (?)2(?)
Comment?)2(?)
Genre:Blues
Length:01:48
Bitrate:192 kbit/s
Frequency:44100 Hz
--------------------------------
msh />usage
cpu: 18
msh />
|