Closed jlsilicon closed 10 months ago
Hi This module has been added by @AnatolSher. I will ask him to review the issue.
Hello! I had testing PSRAM sketch with Air103 board and PS6404L-3SQR-SN chip. It works well.
Maybe your chips are fake? I received defective chips from aliexpress
In the memory browser you can see how the array in psram is reset.
My bench equipment with debugger
Air103 with PSRAM chip
My Chips work - on here if I just use BitBang Code
It's hard for me to imagine what's happening on your computer...
But it works well
Maybe you need to lower the bus speed?
hpsram.Init.Div = 3; (4,5... etc)
Hello! For w801 init function must be static void PSRAM_Init(void) { HAL_RCC_PSRAM_CLK_ENABLE(); HAL_RCC_GPIO_CLK_ENABLE(); // For W801 HAL_AFIO_REMAP_PSRAM_CS(GPIOB, GPIO_PIN_27); HAL_AFIO_REMAP_PSRAM_CLK(GPIOB, GPIO_PIN_0); 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 = 2; hpsram.Init.Mode = PSRAM_MODE_QSPI;
if (HAL_PSRAM_Init(&hpsram) != HAL_OK)
{
Serial.printf("Init error...\r\n");
}
}
It is work! But very strange :)
Sorry, I followed that code above, except I used :
__HAL_AFIO_REMAP_PSRAM_CLK(GPIOA, GPIO_PIN_15);
// __HAL_AFIO_REMAP_PSRAM_CLK(GPIOB, GPIO_PIN_0);
I used chip : Ips6404L-SQ . The specs seem to match to your chip. But the data Written - Reads back as garbage chars.
Yes, I see this too. It doesn't work well on W801 :) But Air103 is the same, only there is no RF Maybe we need a blocking capacitor for the psram chip. I'll solder it now
ps. did not help :(
I am using W806 - is this code compatible with it ?
Must be I plan to test this on the w806 tomorrow Now I have written a small code for wm_w80x_sdk. But, unfortunately, it doesn't work. I`m doing something wrong...
static uint8_t psram_buf = (uint8_t )PSRAM_ADDR_START;
void UserMain(void)
{
uint8_t temp[100];
uint8_t i = 0;
tls_sys_clk_set(CPU_CLK_240M);
wm_psram_config(1); //w801
psram_init(PSRAM_QPI);
while(1) {
memset(psram_buf, 0, 100);
printf("\r\n Clear buf: ");
for(i = 0; i < 100; i++) printf("%x ", psram_buf[i]);
for(i = 0; i < 100; i++) temp[i] = i % 256;
printf("\r\n Read buf: ");
memcpy(psram_buf, temp, 100);
for(i = 0; i < 100; i++) printf("%x ", psram_buf[i]);
tls_os_time_delay(1000);
}
}
Result
Perhaps we should drip here
Your UserMain() code does not compile on the Arduino IDE with Board707 code. What are you compiling with ?
https://github.com/ganhailin/wm_sdk_w801 for exam and CDK dev inv
Hello. Good news for you :) It work on W806
You need this:
Result:
Can you compile with the ? : https://github.com/board707/w80x_arduino
Certainly! bord707 and me did this Arduino core assembly together :)
So what was the code for board707 compile ?
Copy and paste to arduino ide
// Tested on w806 board with PS6404L-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(); HAL_AFIO_REMAP_PSRAM_CS(GPIOB, GPIO_PIN_1); HAL_AFIO_REMAP_PSRAM_CLK(GPIOB, GPIO_PIN_0); 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"); } } Connect the chip correctly ! CS->PB1;CLK->PB0 Enjoy :)
PS. The wires must be very short. PSRAM runs at very high frequency
/*
COMPILES
-
Copy and paste to arduino ide
Connect the chip correctly ! CS->PB1; CLK->PB0
// Tested on w806 board with PS6404L-3SQR-SN chip
-
BRD PSRAM :
PB1 CS \/ +Vdd
PB3 IO1/SO IO3/Hold PB5
PB4 IO2/WP SCLK PB0
Gnd- SI/IO0 PB2
Ly68L6400sLi :
CE! \/ +Vcc
SO/SIO1 SIO3
SIO2 SCLK
-Vss SI/SIO0
*/
//
//
PSRAM_HandleTypeDef hpsram;
static void PSRAM_Init(void);
static uint8_t psram_buf = (uint8_t )PSRAM_ADDR_START;
//
void setup() { Serial.begin(115200); Serial.printf("\r\n> : W806_PSRAM_test_3 : \r\n\r\n");
PSRAM_Init(); }
void loop() { uint8_t temp[100]; int i = 0;
Serial.printf("- Clear & Read PSRAM : \r\n"); memset(psram_buf, 0, 100); for(i = 0; i < 100; i++) { Serial.printf("%x ", psram_buf[i]); } Serial.printf("\r\n");
Serial.printf("- Write Inc# & Read PSRAM : \r\n"); for(i = 0; i < 100; i++) { temp[i] = i % 256; }
Serial.printf("- Clear & Read PSRAM : \r\n"); memcpy(psram_buf, temp, 100); for(i = 0; i < 100; i++) { Serial.printf("%x ", psram_buf[i]); } Serial.printf("\r\n");
Serial.printf("- Write Letters & Read PSRAM : \r\n"); Serial.printf( "- W: #0=[A] "); psram_buf[0] = 'A' ; Serial.printf( "R: #0=>[%c] ",psram_buf[0]);
Serial.printf("; - W: #1=[A] ");
psram_buf[1] = 'z' ;
Serial.printf(", R: #1=>[%c] ",psram_buf[1]);
Serial.printf("; R: #0=>[%c] ",psram_buf[0]);
Serial.printf(", R: #1=>[%c] ",psram_buf[1]);
Serial.printf("\r\n");
Serial.printf("\r\n");
delay(1000); }
//
static void PSRAM_Init(void) { HAL_RCC_PSRAM_CLK_ENABLE(); HAL_RCC_GPIO_CLK_ENABLE(); HAL_AFIO_REMAP_PSRAM_CS(GPIOB, GPIO_PIN_1); HAL_AFIO_REMAP_PSRAM_CLK(GPIOB, GPIO_PIN_0); 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"); } }
///
OUTPUT :
-- Clear & Read PSRAM : 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -- Write Inc# & Read PSRAM : 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -- Clear & Read PSRAM : 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 60 61 62 63 // <- Old Data ??? -- Write Letters & Read PSRAM : -- W: #0=[A] R: #0=>[A] ;
-- W: #1=[A] , R: #1=>[z] ;
-- R: #0=>[] , // <- The data is last char Written , but not Reading / Writing PSRAM => char z ??? -- R: #1=>[z]
--
The data is last char Written , but not Reading PSRAM
Does your PSRAM code include ? :
// WrtByt: RESET_EN = 0x66 = 0b01100110 : // digitalWrite( PB1 , LOW ); SPI.transfer( 0x66 ); digitalWrite( PB1 , HIGH );
// WrtByt: RESET = 0x99 = 0b10011001 : // digitalWrite( PB1 , LOW ); SPI.transfer( 0x99 ); digitalWrite( PB1 , HIGH );
-- Needed after PSRAM powerup , before Writing data
My chip seems to be Reading data, but Not Writing Data to PSRAM.
I dont see SPI.begin();
There is a specialized SPRAM controller on board the w806 chip. Thanks to it, we can address it like regular memory. SPI interface is not needed here. Show me a photo of how you connected the psram chip and the board
Initialization of the psram controller is described in the HAL. You can find this in the drivers folder C:\Users\User\AppData\Local\Arduino15\packages\w80x_duino\hardware\XT804\0.0.5\cores\w806\lib\drivers This file - wm_psram.c
I think its wired correctly - if I keep reading ABC at address 96.
OUTPUT - always repeated reading address 0 - 100 :
Read works , but Write does not with this code.
Thank you! Very long wires!!! Do it as I showed in my photo with w806. https://github.com/board707/w80x_arduino/issues/31#issuecomment-1770407561 The operating frequency of psram is more than 100 MHz. It won't work with this connection.
I glued it with 2-sided tape. make sure it doesn't short out any components on the board
no. As I said , it seems to be Reading old values from my Bitbang SPI. Just not Successfully Writing new data to the PSRAM.
you are reading the latest data from the controller's psram buffer. not from a chip... maybe
I dont write x60 x61 x62 x63 in my code anywhere
I also changed the Div to 32 :
hpsram.Init.Div = 32;
strcpy((char)psram_buf, (char)"AbCdEfGhIjKlMnOpQrStUvWxYz ** ");
=>
00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 2A 2A * 20 00 .
// strcpy((char)psram_buf, (char)"0 1 2 3 4 5 6 7 8 9 *** "); => 00 . 00 . 00 . 7A z 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 .
I recompiled at 80MHz with div=32 - but no difference. I recompiled at 80MHz with div=15 - but no difference.
hpsram.Init.Div = 32; - no; from 2 to 15. 4 binary digits - max 0b1111
You need to solder the chip on top of the board. psram is a very capricious thing. There may be bad contacts on the bredboard
Does your PSRAM code include ? :
// WrtByt: RESET_EN = 0x66 = 0b01100110 : // digitalWrite( PB1 , LOW ); SPI.transfer( 0x66 ); digitalWrite( PB1 , HIGH );
// WrtByt: RESET = 0x99 = 0b10011001 : // digitalWrite( PB1 , LOW ); SPI.transfer( 0x99 ); digitalWrite( PB1 , HIGH );
-- Needed after PSRAM powerup , before Writing data
When we to do soft reset the psram controller, this sequence is transmitted automatically. PSRAM reset Writing 1 to control register (b[0]) starts the reset operation to PSRAM, and it is automatically cleared after reset.
The datasheet says that the psram controller is clocked from the AHB-1 bus. This is the processor clock bus. They also say that psram operates at 80 MHz. Therefore we have two possible values for the divisor. 3 for 240Mhz and 2 for 160Mhz. The divisor cannot be less than 2. Other processor clock frequencies will not work with psram.
Employees of the WinnerMicro company told me a long time ago that they use the original LY68L6400SLIT (Lyontek) as a psram chip only. It's a miracle that other chips sometimes work :)... maybe
I see, I am stuck with just BitBang or SPI.tx/rx .
Let me try the SPI.tx/rx then... No
Just the SPI Bitbanging works so far ...
OK. Figured out part of the problem. I had PSRAM +Vcc connected to Gnd.
Now I get this :
Writing "AZaz " :
Reading : => "⸮⸮⸮⸮⸮" :
Read Default PSRAM : 41 A 71 q 75 u 77 w 56 V 66 f 55 U 68 h 99 . 66 f 4B K 64 d 4D M 66 f 4F O 55 U 55 U 77 w 51 Q 77 w 55 U 77 w 55 U 71 q 51 Q 77 w 02 . A2 . A2 . A2 . 00 . 02 . 02 . 12 . 22 " 32 2 42 B 52 R 62 b 72 r 82 . 92 . A2 . B2 . C2 . D2 . E2 . F3 . 30 0 31 1 33 3 33 3 31 1 31 1 32 2 33 3 31 1 31 1 3A : 33 3 31 1 31 1 3E > B3 . 04 . 11 . 42 B 11 . 44 D 54 T 46 F 47 G 88 . 99 . 4A J 91 . 4C L DD . 4E N F5 . 50 P 55 U 55 U 51 Q 55 U 55 U 55 U 55 U 00 . 00 . 00 . 05 . 55 U 55 U 5E ^ 55 U 60 ` 11 . 46 F 63 c
Clear & Read PSRAM : 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 .
Write Inc# & Read PSRAM : 00 . 11 . 02 . 33 3 04 . 55 U 06 . 51 Q 08 . 99 . 0A . 91 . 0C . D5 . 0E . 80 . 10 . 11 . 12 . 11 . 14 . 15 . 16 . 11 . 18 . 11 . 1A . 91 . 1C . 91 . 1E . 91 . 20 12 . 22 " 32 2 42 B 52 R 66 f 27 ' 82 . 92 . A2 . B2 . C2 . DD . 2E . F3 . 30 0 31 1 33 3 33 3 30 0 31 1 32 2 33 3 31 1 31 1 33 3 3B ; 30 0 31 1 3E > B3 . 40 @ 11 . 44 D 43 C 44 D 45 E 46 F 47 G 88 . 99 . 4A J 91 . 4C L D5 . 4E N D5 . 50 P 51 Q 51 Q 51 Q 55 U 55 U 55 U 55 U 51 Q 51 Q 5A Z 51 Q 5C \ 55 U 5E ^ 55 U 60 ` 61 a 62 b 63 c
Set Abc & Read PSRAM : 01 . 46 F 43 C 66 f 55 U 66 f 47 G 64 d 99 . 66 f 4B K 64 d 4D M 66 f 4F O 77 w 51 Q 77 w 51 Q 77 w 55 U 77 w 55 U 75 u 51 Q 77 w 20 A2 . 2A 2A 20 00 . 02 . 12 . 22 " 32 2 42 B 52 R 66 f 27 ' 82 . 92 . A2 . B2 . C2 . DD . 2E . F3 . 30 0 31 1 33 3 33 3 31 1 31 1 32 2 33 3 31 1 31 1 33 3 3B ; 30 0 31 1 3E > B3 . 00 . 01 . 44 D 13 . 44 D 55 U 46 F 57 W 48 H 01 . 4A J 91 . 4C L DD . 4E N D5 . 50 P 51 Q 51 Q 51 Q 55 U 55 U 55 U 55 U 51 Q 51 Q 5A Z 51 Q 5C \ 55 U 5E ^ 55 U 60 ` 63 c 46 F 63 c 77 w DD . 51 Q DD . 55 U 66 f 07 . 46 F C4 . 64 d F4 . 55 U DD . 54 T EE . 0F . F9 . 75 u 75 u 77 w 66 f 05 . 55 U 9C . 00 . D9 . FD . 99 .
-- Write Letters & Read PSRAM : -- W: #0=[A] R: #0=>[A] -- W: #1=[x] , R: #1=>[x] -- W: #2=[y] , R: #2=>[y] -- W: #3=[z] , R: #3=>[z] = > R: #0=>[.] R: #1=>[w] R: #2=>[y] R: #3=>[z]
Code:
` //
//
PSRAM_HandleTypeDef hpsram; static void PSRAM_Init(void); static uint8_t psram_buf = (uint8_t )PSRAM_ADDR_START; uint8_t temp[100];
//
void setup() { // SystemClock_Config(CPU_CLK_240M); /// - 240MHz
Serial.begin(115200); Serial.printf("\r\n> : W806_PSRAM_test_3 : \r\n\r\n");
SPI_PSRAM_Reset();
Serial.printf("* Writing \"AZaz \" : \r\n"); digitalWrite( PB1 , LOW ); SPI.transfer( 0x02 ); SPI.transfer( 0x00 ); SPI.transfer( 0x00 ); SPI.transfer( 0x00 ); SPI.transfer( 0x41 ); SPI.transfer( 0x61 ); SPI.transfer( 0x5A ); SPI.transfer( 0x7A ); SPI.transfer( 0x20 ); digitalWrite( PB1 , HIGH );
Serial.printf("* Reading : \r\n"); digitalWrite( PB1 , LOW ); SPI.transfer( 0x03 ); SPI.transfer( 0x00 ); SPI.transfer( 0x00 ); SPI.transfer( 0x00 ); temp[0] = SPI.transfer( 0xFF ); temp[1] = SPI.transfer( 0xFF ); temp[2] = SPI.transfer( 0xFF ); temp[3] = SPI.transfer( 0xFF ); temp[4] = SPI.transfer( 0xFF ); temp[5] = 0; digitalWrite( PB1 , HIGH ); Serial.printf(" => \"%s\" : \r\n\r\n" , temp );
PSRAM_Init(); // SPI_PSRAM_Reset(); }
void loop() { // uint8_t temp[100]; int i = 0; char c ;
Serial.printf("- Read Default PSRAM : \r\n"); for(i = 0; i < 100; i++) { Serial.printf("%02X ", (c=psram_buf[i]) );
if( c > 0x1F && c < 0x80 )
Serial.printf("%c ", c );
else
Serial.printf(". ");
if( i % 16 == 15 )
Serial.printf("\r\n");
} Serial.printf("\r\n");
Serial.printf("- Clear & Read PSRAM : \r\n"); memset(psram_buf, 0, 100); for(i = 0; i < 100; i++) { Serial.printf("%02X ", (c=psram_buf[i]) );
if( c > 0x1F && c < 0x80 )
Serial.printf("%c ", c );
else
Serial.printf(". ");
if( i % 16 == 15 )
Serial.printf("\r\n");
} Serial.printf("\r\n");
Serial.printf("- Write Inc# & Read PSRAM : \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("%02X ", (c=psram_buf[i]) );
if( c > 0x1F && c < 0x80 )
Serial.printf("%c ", c );
else
Serial.printf(". ");
if( i % 16 == 15 )
Serial.printf("\r\n");
} Serial.printf("\r\n");
Serial.printf("\r\n- Set Abc & Read PSRAM : \r\n"); strcpy((char)psram_buf, (char)"AbCdEfGhIjKlMnOpQrStUvWxYz "); // strcpy((char)psram_buf, (char)"0 1 2 3 4 5 6 7 8 9 "); // for(i = 0; i < 100; i++) for(i = 0; i < 128; i++) // for(i = 0; i < 1000; i++) // for(i = 0; i < 10000; i++) { Serial.printf("%02X ", (c=psram_buf[i]) );
if( c > 0x1F && c < 0x80 )
Serial.printf("%c ", c );
else
Serial.printf(". ");
if( i % 16 == 15 )
Serial.printf("\r\n");
} Serial.printf("\r\n");
Serial.printf("\r\n- Write Letters & Read PSRAM : \r\n"); Serial.printf( "- W: #0=[A] "); psram_buf[0] = 'A' ; Serial.printf( ", R: #0=>[%c] \r\n",psram_buf[0]);
Serial.printf("- W: #1=[x] ");
psram_buf[1] = 'x' ;
Serial.printf(", R: #1=>[%c] \r\n",psram_buf[1]);
Serial.printf("- W: #2=[y] ");
psram_buf[2] = 'y' ;
Serial.printf(", R: #2=>[%c] \r\n",psram_buf[2]);
Serial.printf("- W: #3=[z] ");
psram_buf[3] = 'z' ;
Serial.printf(", R: #3=>[%c] \r\n",psram_buf[3]);
Serial.printf("=> R: #0=>[%c] \r\n",psram_buf[0]);
Serial.printf(" R: #1=>[%c] \r\n",psram_buf[1]);
Serial.printf(" R: #2=>[%c] \r\n",psram_buf[2]);
Serial.printf(" R: #3=>[%c] \r\n",psram_buf[3]);
Serial.printf("\r\n");
delay(1000); }
//
static void PSRAM_Init(void) { HAL_RCC_PSRAM_CLK_ENABLE(); HAL_RCC_GPIO_CLK_ENABLE();
HAL_AFIO_REMAP_PSRAM_CS(GPIOB, GPIO_PIN_1); // PB1 / CS HAL_AFIO_REMAP_PSRAM_CLK(GPIOB, GPIO_PIN_0); // PB0 / SCLK HAL_AFIO_REMAP_PSRAM_D0(GPIOB, GPIO_PIN_2); // PB2 / MOSI HAL_AFIO_REMAP_PSRAM_D1(GPIOB, GPIO_PIN_3); // PB3 / MISO HAL_AFIO_REMAP_PSRAM_D2(GPIOB, GPIO_PIN_4); // PB4 HAL_AFIO_REMAP_PSRAM_D3(GPIOB, GPIO_PIN_5); // PB5
hpsram.Instance = PSRAM; hpsram.Init.Div = 3; // hpsram.Init.Div = 15; // - 2-15 // hpsram.Init.Div = 20; // hpsram.Init.Div = 32; hpsram.Init.Mode = PSRAM_MODE_QSPI;
if (HAL_PSRAM_Init(&hpsram) != HAL_OK) { Serial.printf("Init error...\r\n"); }
// SPI_PSRAM_Reset();
}
void SPI_PSRAM_Reset() {
/// Reset PSRAM : /// /// HardSPI::transfer(uint8_t val) : /// // HardSPI::transfer( 0x66 );
/// SPI.setSPIpins(uint8_t mosi, uint8_t miso, uint8_t sck) : /// SPI.setSPIpins( PB2, PB3, PB0 ); SPI.begin();
pinMode( PB1 , OUTPUT ); digitalWrite( PB1 , HIGH );
digitalWrite( PB1 , LOW ); SPI.transfer( 0x66 ); digitalWrite( PB1 , HIGH );
digitalWrite( PB1 , LOW ); SPI.transfer( 0x99 ); digitalWrite( PB1 , HIGH ); } `
I tried with your short Wires + Caps (1uF , 0.1uF).
Still same output.
Waiting on your PSRAM chips that I ordered : -- ESP-PSRAM64H -- LY68L6400SLIT
I tried with your very short Wires.
Just got worse :
Waiting on your PSRAM chips that I ordered : -- ESP-PSRAM64H -- LY68L6400SLIT
Your Code , does Not match your Chip Wiring :
` static void PSRAM_Init(void) { HAL_RCC_PSRAM_CLK_ENABLE(); HAL_RCC_GPIO_CLK_ENABLE(); HAL_AFIO_REMAP_PSRAM_CS(GPIOB, GPIO_PIN_1); HAL_AFIO_REMAP_PSRAM_CLK(GPIOB, GPIO_PIN_0); 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; `
Ok , I Fixed it ! My Wiring was Wrong : PB9 - is mislabeled as PBS - which looks like PB5 ...
Thanks for the Help !
Aps6404 Chip is good.
LOOP :
-- Read Default PSRAM : 00 . 01 . 02 . 03 . 04 . 05 . 06 . 07 . 08 . 09 . 0A . 0B . 0C . 0D . 0E . 0F . 10 . 11 . 12 . 13 . 14 . 15 . 16 . 17 . 18 . 19 . 1A . 1B . 1C . 1D . 1E . 1F . 20 21 ! 22 " 23 # 24 $ 25 % 26 & 27 ' 28 ( 29 ) 2A * 2B + 2C , 2D - 2E . 2F / 30 0 31 1 32 2 33 3 34 4 35 5 36 6 37 7 38 8 39 9 3A : 3B ; 3C < 3D = 3E > 3F ? 40 @ 41 A 42 B 43 C 44 D 45 E 46 F 47 G 48 H 49 I 4A J 4B K 4C L 4D M 4E N 4F O 50 P 51 Q 52 R 53 S 54 T 55 U 56 V 57 W 58 X 59 Y 5A Z 5B [ 5C \ 5D ] 5E ^ 5F _ 60 ` 61 a 62 b 63 c 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 .
-- Clear & Read PSRAM : 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 .
-- Set Abc & Read PSRAM :
41 A 62 b 43 C 64 d 45 E 66 f 47 G 68 h 49 I 6A j 4B K BB . 4D M 6E n 4F O FF .
51 Q 72 r 53 S 74 t 55 U 76 v 57 W 78 x 59 Y 7A z 20 2A 2A 2A 20 30 0
20 31 1 20 32 2 20 33 3 20 34 4 20 35 5 20 36 6 20 37 7 20 38 8
20 39 9 20 2A 2A 2A 20 20 20 20 20 20 20 20 20 20
20 35 5 36 6 37 7 38 8 39 9 30 0 31 1 32 2 33 3 34 4 35 5 36 6 37 7 38 8 39 9
30 0 31 1 32 2 33 3 34 4 35 5 36 6 37 7 38 8 39 9 30 0 31 1 32 2 33 3 34 4 35 5
36 6 37 7 38 8 39 9 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 .
00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 .
-- Write Inc# & Read PSRAM : 00 . 01 . 02 . 03 . 04 . 05 . 06 . 07 . 08 . 09 . 0A . 0B . 0C . 0D . 0E . 0F . 10 . 11 . 12 . 13 . 14 . 15 . 16 . 17 . 18 . 19 . 1A . 1B . 1C . 1D . 1E . 1F . 20 21 ! 22 " 23 # 24 $ 25 % 26 & 27 ' 28 ( 29 ) 2A * 2B + 2C , 2D - 2E . 2F / 30 0 31 1 32 2 33 3 34 4 35 5 36 6 37 7 38 8 39 9 3A : 3B ; 3C < 3D = 3E > 3F ? 40 @ 41 A 42 B 43 C 44 D 45 E 46 F 47 G 48 H 49 I 4A J 4B K 4C L 4D M 4E N 4F O 50 P 51 Q 52 R 53 S 54 T 55 U 56 V 57 W 58 X 59 Y 5A Z 5B [ 5C \ 5D ] 5E ^ 5F _ 60 ` 61 a 62 b 63 c 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 . 00 .
-- Write Letters & Read PSRAM : -- W: #0=[A] , R: #0=>[A] -- W: #1=[x] , R: #1=>[x] -- W: #2=[y] , R: #2=>[y] -- W: #3=[z] , R: #3=>[z] = > R: #0=>[A] R: #1=>[w] R: #2=>[y] R: #3=>[z]
PSRAM Works now. -- On Short and Long Wires Boards.
Except :
Yep - Shortened the Wires - No problems now - Fixed
Congratulations! LY68L6400SLIT I will check when the package arrives from Aliexpress. I hope that I will be lucky and they will send me good and original chips. Follow the discussions, I will publish the result there. malloc() is not suitable for dynamic memory allocation. There are other approaches that WinnerMicro recommends. A little bit later I will give code examples. If you have solved your problems at this stage, please close the issue
PS/ Watch lessons on YouTube from Altium designer - how to install high-frequency circuits
PPS. Today I tested the APS6404 at all clock speeds. (240...40) It works and you can even play with the divider! Perhaps I didn’t translate the datasheet correctly and the W806 allows you to flexibly adjust the PSRAM exchange rate
I dont think Malloc() is a problem - it does not cause a problem now.
I think that it was just too long leads - which fixed it.
@jcoleman-oneaihealth If your issue has been fixed - please close the issue and star our repo! :)
You are the Owner - I can Not Close it ... On Monday, October 23, 2023 at 12:22:04 PM EDT, board707 @.***> wrote:
@jcoleman-oneaihealth If your issue has been fixed - please close the issue and star our repo! :)
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
Can Not get
PSRAM_test.ino
to work - using Ips6404-SQPII integrated the Ips6404-SQPI to W806 : -- but it only returns and prints garbage back.
Pad pin mapping relationship :
SCLK -> PA_15 PSRAM_CK
SI/IO0 -> PB_02 PSRAM_D0
01/SO -> PB_03 PSRAM_D1
WP -> PB_04 PSRAM_D2
HOLD -> PB_05 PSRAM_D3
CS -> PB_27 PSRAM_CS
BRD PSRAM :
PB27 CS \/ +Vdd
PB3 01/SO Hold PB5
PB4 WP SCLK PA15
Gnd- SI/IO0 PB2
-- I also tried SPI_Basic.ino - no results either.
-> Has the PSRAM_test.ino been tested ?