Memory tester (self test) (Teensy3.6)

Status
Not open for further replies.

OmnipotentEntity

New member
Hello!

This is my first teensy3.6 project. While I've done some mbed programming in the past, nothing was nearly as technical and barebones as I'm trying to do right now. So I'm looking for some direction if possible.

Background:

I'm building an autonomous radiation detecting robot as part of a larger team. I'd like to use the teensy as a small realtime device to control servomotors on a relatively exposed area of the robot, and thus I need to test its response to radiation to see if the radiation we're dealing with is enough of a problem that we need to budget some extra shielding. I can tolerate random bitflips from radiation, I'd just like to know whether or not this device is susceptible to radiation damage.

I have several teensys, and I've irradiated one of them for 24 hours with a 1 Ci PuBe source. I've given it a few days to decay away any activation products, and I'm interested if the onboard flash and sram is still fully functional, or if they've been damaged permanently by the flux.

Goal:

I'd like to write a simple program to test the teensy's memory, akin to memtest86. Unfortunately, this means that I have to somewhat bypass the normal memory allocation procedure, because I want to ensure I get full coverage, and I'd like to test as much memory as possible.

Questions:

1. May I assume that when I receive control from the bootloader during the "setup" phase, that all of the dynamic memory that the system will need has already been allocated? May I also assume that no system calls will attempt to allocate memory during an interrupt during the "setup" function?
2. What is the best way to read malloc's (or new's!) internal allocation table?
3. Is assembly programming from within the arduino compiler as simple as just using a gcc asm directive?
4. And to double check my understanding from the documentation, the SRAM's lower address is 0x1FFF0000 and its upper address is 0x2002FFFF, correct?
 
Years ago I wrote a program to test the memory on Teensy 3.1. It's similar in concept to memtest86, though the patterns are fairly simple and several pseudo-random patterns are used.

Here's the code:

https://github.com/PaulStoffregen/k72memtest

You'll need to edit the makefile to the full pathname of the compiler. While this code is very old (Arduino 1.0.5 was the most recent version), it should probably still work with the toolchain we're using in modern versions.

The result is a HEX file. You just program it onto the Teensy, then reboot or power cycle. When the test completes, the LED turns on solid for a pass, or blinks rapidly if anything fails.

While this code is written in C, it's structured in a careful way that allows the compiler to do everything within the registers. If you make substantial edits, I'd recommend inspecting the generated assembly (the makefile gives you a .lst output for this purpose). Obviously it will fail if your code uses the stack, since all of the memory gets repeatedly overwritten.
 
Hey! Thanks a million!

I was able to update it for the Teensy3.6 and it seems to function AOK.

Would you like a pull request? Or are you satisfied with how it is now?
 
OK, I fetched the latest and tested T3.2 and T3.6. LED came on solid so all must be well. Only RAM is tested.

I also tested on T3.5, modified Makefile and k72memtest.c, and fetched mk64fx512.ld and edited to support 256KB RAM on T3.5 :D Ran on T3.5 and LED came on solid.

loaded with teensy_loader_cli -mmcu=mk64fx512 -w k72memtest-3.5.hex


thanks
 
Last edited:
Status
Not open for further replies.
Back
Top