Bill Greiman
Well-known member
Teensy 3.6 MPU puzzle? Memory Protection?
Why is the MPU enabled for Teensy 3.6?
I am writing a new SDHC driver and am looking at various existing SDHC drivers for the K66.
All the SDHC example I look at disable the MPU. In fact there are about 80 examples in the K66 SDK that have this call in main().
Some are for SDHC, some for USB devices, and some for Ethernet.
Here is the hex value of MPU_CESR at the start of setup(). The low bit enabling the MPU is set.
The only code I find in teensy 130b for the MPU is this.
D:\Teensy\teensy130b\hardware\teensy\avr\cores\teensy3\usb_dev.c
line 1111:
If I comment this out there are problems.
However If I put this before Serial.begin(9600) and comment out the code in usb_dev.c things seem to work OK.
I don't like putting code to disable the MPU in a SDHC driver.
So why is the MPU enabled in Teensy 3.6?
Why is the MPU enabled for Teensy 3.6?
I am writing a new SDHC driver and am looking at various existing SDHC drivers for the K66.
All the SDHC example I look at disable the MPU. In fact there are about 80 examples in the K66 SDK that have this call in main().
Some are for SDHC, some for USB devices, and some for Ethernet.
Code:
/* Disable MPU. */
MPU_Enable(MPU, false);
Here is the hex value of MPU_CESR at the start of setup(). The low bit enabling the MPU is set.
Code:
MPU_CESR: 815101
The only code I find in teensy 130b for the MPU is this.
D:\Teensy\teensy130b\hardware\teensy\avr\cores\teensy3\usb_dev.c
line 1111:
Code:
#ifdef HAS_KINETIS_MPU
MPU_RGDAAC0 |= 0x03000000;
#endif
If I comment this out there are problems.
However If I put this before Serial.begin(9600) and comment out the code in usb_dev.c things seem to work OK.
Code:
MPU_CESR &= ~MPU_CESR_VLD_MASK;
I don't like putting code to disable the MPU in a SDHC driver.
So why is the MPU enabled in Teensy 3.6?
Last edited: