使用 aps6404l 作为 psram 的扩容芯片, wm_psram_config (0) ; psram_init (1) ; 初始化后 uint8_t membase = (uint8_t) (0x30000000) ; 结果:
现象和不接 psram 芯片相同, 都是只能读取 写入的最后一个字节. 因为 sdk 中没有对 psram 芯片的底层数据读取和输入接口函数, 所以无法调试是否扩容芯片正确连接. 成功扩容的是否方便告知选用了哪个 psram 芯片
Hello! I observed this behavior when I bought a batch of defective chips.
After installing working chips on the Air103 board, everything works well
Code for testing:
#include "Arduino. h"
// Tested on Air103 board with APS6404L-3SQR-SN chip
PSRAM_HandleTypeDef hpsram;
static void PSRAM_Init (void) ;
static uint8_t *psram_buf = (uint8_t *) PSRAM_ADDR_START;
void setup ()
{
Serial. begin (115200) ;
PSRAM_Init () ;
}
void loop ()
{
uint8_t temp[100];
int i = 0;
memset (psram_buf, 0, 100) ;
for (i = 0; i " 100; i++)
{
Serial. printf ("%x ", psram_buf[i]) ;
}
Serial. printf ("\r\n") ;
for (i = 0; i " 100; i++)
{
temp[i] = i % 256;
}
memcpy (psram_buf, temp, 100) ;
for (i = 0; i " 100; i++)
{
Serial. printf ("%x ", psram_buf[i]) ;
}
Serial. printf ("\r\n") ;
delay (1000) ;
}
static void PSRAM_Init (void)
{
__HAL_RCC_PSRAM_CLK_ENABLE () ;
__HAL_RCC_GPIO_CLK_ENABLE () ;
// For Air103
__HAL_AFIO_REMAP_PSRAM_CS (GPIOB, GPIO_PIN_27) ;
__HAL_AFIO_REMAP_PSRAM_CLK (GPIOA, GPIO_PIN_15) ;
__HAL_AFIO_REMAP_PSRAM_D0 (GPIOB, GPIO_PIN_2) ;
__HAL_AFIO_REMAP_PSRAM_D1 (GPIOB, GPIO_PIN_3) ;
__HAL_AFIO_REMAP_PSRAM_D2 (GPIOB, GPIO_PIN_4) ;
__HAL_AFIO_REMAP_PSRAM_D3 (GPIOB, GPIO_PIN_5) ;
hpsram. Instance = PSRAM;
hpsram. Init. Div = 3;
hpsram. Init. Mode = PSRAM_MODE_QSPI;
if (HAL_PSRAM_Init (&hpsram) ! = HAL_OK)
{
Serial. printf ("Init error. . . \r\n") ;
}
}
This code is based on HAL 0. 6. 0 and will work on w801