analogdevicesinc / msdk

Software Development Kit for Analog Device's MAX-series microcontrollers
Apache License 2.0
60 stars 76 forks source link

MAX78000 support of external SPIRAM #616

Closed matti122 closed 6 months ago

matti122 commented 1 year ago

I want to use an external SPI RAM with MAX78000 on a custom PCB. But I'm not able to find the Driver and example to use the external SPIRAM N01S830HAT22I which is used on MAX78000FTHR Board. Could you please help to identify how I can use the external SPIRAM. Thanks

BitSalat commented 1 year ago

Would be interested as well - on the feather EVK an OnSemi 1MByte SPI RAM is implemented but no library or reference example in the software is available Can u please clarify?

Jake-Carter commented 1 year ago

You're right, it looks like we're missing drivers for it in the SDK.

The IC looks very similar to the APS6404 SRAM which I recently wrote drivers for. You can find them in the QSPI Example for the MAX78002.

It should be easy to adapt the example/drivers. I'll try to do it by the end of the week. In the meantime you can reference the QSPI example and its drivers yourself

Jake-Carter commented 1 year ago

@matti122 @BitSalat

I was able to complete some preliminary drivers this afternoon. The main challenge for this SRAM is its "hold" feature. I found I had to disable it in the mode register to get it to work reliably.

You can find the updated drivers and example on the dev/N01S830HA-drivers branch of my fork here.

Again, be warned this is a preliminary solution. It may change significantly before the next release. We are trying to freeze our codebase next Tuesday, so this may or may not make it in to the official June release.

Everything seems functional at its max speed of 20Mhz except for tests 7-9, which test operations across page boundaries. I will need to troubleshoot this further next week.

QSPI SRAM Test:
        Test Address: 0x0
        Test size: 640 bytes
        Test count: 480 rows
        Test speed: 2000000 Hz
(Benchmark) Wrote 640 bytes to internal SRAM in 5us
Test 1: Standard SPI write...
        Done (640 bytes in 2594us)
Test 2: Validate w/ standard SPI...
        Read finished (640 bytes in 2593us)
        Checking for mismatches...
        Done
Test 3: Validate w/ QSPI...
        Read finished (640 bytes in 660us)
        Checking for mismatches...
        Done
Test 4: QSPI Write...
        Done (640 bytes in 663us)
Test 5: Validate w/ standard SPI...
        Read finished (640 bytes in 2593us)
        Checking for mismatches...
        Done
Test 6: Validate w/ QSPI...
        Read finished (640 bytes in 660us)
        Checking for mismatches...
        Done
Test 7: QSPI Writing across page boundaries...
        Wrote 307200 bytes in 317693us
Test 8: Validating with standard SPI...
        Failed (305760) mismatches
Test 9: Validating with QSPI...
        Failed (305760) mismatches

Failed with 611520 mismatches (199.06%)!
Jake-Carter commented 1 year ago

@matti122 @BitSalat this did not make the cut-off for our June release, but I'll get in some more polished drivers asap.

It would be helpful if you can confirm you can replicate the linked example above on your boards.

matti122 commented 1 year ago

Hello Jake, we are still in Design phase and our own PCB is currently not ready. I tested it with MAX78000 Feather Board and got same results. Best regards Matthias