Sanity Check And Advice On Modifying Teensy 4.1 Core For MRAM/FRAM EXTRAM Support

Status
Not open for further replies.

Michael2

Member
Background:
I am working on a project and I needed reliable non-volatile memory that could be frequently written to without degrading the lifespan of the memory chip. I thought that adding an MRAM or FRAM chip to the bottom of the teensy 4.1 and using it just like external PSRAM would be a really cool and easy thing to and it would solve my problem. I asked about it in this thread but I was basically told that it would be really hard to do and to not underestimate what it would take. I am only 17yo so I definitely did not underestimate what it would take, but for some reason, I still could not stop myself from trying anyway.
So after hours of reading the imxrt documentation and googling literally everything I read, I modified the teensy 4 core to support the AS3001204 MRAM chip. I think I have most of it done but I would not be surprised if I made a few mistakes, misunderstood something, or forgotten something altogether.

Code:
You can find the modified core files here: https://github.com/Michael2MacDonald/teensy4_core_extmem_improvments

I would appreciate it if someone smarter than me would take a look at it and tell me if it might work before I buy chips and solder them onto my precious Teensy 4.1.

Explanation Of What I Did:

I basically added a second memory section in the linker file and allowed you to change the size of both sections using the makefile or the Arduino tools menu in the ide. This allows you to use one or two RAM chips and the RAM chips don't have to be the same type or size. To support MRAM/FRAM chips, I also added the ability to change the instruction set for each chip to one of two presets; teensy PSRAM or AS3001204. It is built to be easy to add additional instruction sets to expand the compatible chips to choose from.

Because of the two memory sections, you can use two RAM chips separately using 'EXTMEM' and 'EXTMEM2' or you can configure the first memory section to cover the size of both chips allowing you to use them both with 'EXTMEM' just like in the normal Teensy core. If you use both chips in one memory section I would assume they have to be the same chip though.

By default, it is set up to work normally with the Teensy PSRAM chips without the need to change or set up anything so it should be 100% backward compatible

I also added support for malloc() by just creating a second set of identical functions but for the second memory section. For example, you would use "extmem2_malloc()" for the second memory section.
 
Last edited:
Status
Not open for further replies.
Back
Top