使用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