gigapod
September 3, 2024, 8:59pm
1
The software development ecosystems were not fully supported with the RP2350 was launched, but this is rapidly developing.
Here is what we (SparkFun) are aware of:
A pico-sdk
library that enables the use of PSRAM is here
A version of micropython
that uses PSRAM is available here - see the releases section for the latest firmware, or build your own by using the branch feature/psram-sparkfun
Arduino support is now available using this Arduino Core on github earlephilhower/arduino-pico
As more information is available ,we’ll be sure to pass this on.
-Kirk
1 Like
Well, the git microython repo has no source references anywhere for the rp2350. Only the UF2 file. Could not find the feature/psram-sparkfun branch.
But I have some questions: What are the PSRAM start and end memory addresses? Is it contiguous? I should be able to read and write using the viper emitter pointers once I have these values.
gigapod
September 8, 2024, 1:03am
3
Hi - The branch is there - just checked. You do need to use the branch search feature to find it - there’s a large number of branches.
Does this link help?
https://github.com/sparkfun/micropython-rp2350/tree/feature/psram-sparkfun
On the rp2350 - the psram is contiguous- the start address is defined here:
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2024 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
This file has been truncated. show original
And the setup is in the corresponding c file.
The psram is added to the uPy allocator here:
// Start and initialise the RTC
struct timespec ts = { 0, 0 };
ts.tv_sec = timeutils_seconds_since_epoch(2021, 1, 1, 0, 0, 0);
aon_timer_start(&ts);
mp_hal_time_ns_set_from_rtc();
// Initialise stack extents and GC heap.
mp_cstack_init_with_top(&__StackTop, &__StackTop - &__StackBottom);
#if defined(MICROPY_HW_PSRAM_CS_PIN) && MICROPY_HW_ENABLE_PSRAM && defined(MICROPY_HW_PSRAM_MAX_SCK_HZ)
size_t psram_size = rp2_psram_init(MICROPY_HW_PSRAM_CS_PIN, MICROPY_HW_PSRAM_MAX_SCK_HZ);
if (psram_size) {
#if MICROPY_GC_SPLIT_HEAP
gc_init(&__GcHeapStart, &__GcHeapEnd);
gc_add((void *)PSRAM_LOCATION, (void *)(PSRAM_LOCATION + psram_size));
#else
gc_init((void *)PSRAM_LOCATION, (void *)(PSRAM_LOCATION + psram_size));
#endif
} else {
gc_init(&__GcHeapStart, &__GcHeapEnd);
Hope that helps!
Kirk
Seems that MICROPY_GC_SPLIT_HEAP is set to (0). Correct? That’s what I want.
gigapod
September 8, 2024, 1:05pm
6
Yes, that should be enabled.
I also fixed this in our micropython port - so the code and latest release now support “all the *ram” on the board.
// PSRAM things
// Enable PSRAM
#define MICROPY_HW_ENABLE_PSRAM (1)
// CS Pin for the boards PSRAM
#define MICROPY_HW_PSRAM_CS_PIN (19)
// PSRAM max frequency is based on VDD (see datasheet) - SparkFun Pro Micro RP2350 uses 3.3V => 109MHz
#define MICROPY_HW_PSRAM_MAX_SCK_HZ (109*1000*1000)
// Enable the heap split - heap is split between sram and psram memory
#define MICROPY_GC_SPLIT_HEAP (1)
// NeoPixel data GPIO25, power not toggleable