aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2010-08-07 21:25:51 -0400
committerbnewbold <bnewbold@robocracy.org>2010-08-07 21:25:51 -0400
commitb2dd49c3141d8a21a4e7c7ef51dee7329f847c30 (patch)
tree6677879437eb8b227ee64b71dcfeb6d707b68af9
parent7b391d7f76a2d56242420c560d65f00a60f78682 (diff)
downloadlibrambutan-b2dd49c3141d8a21a4e7c7ef51dee7329f847c30.tar.gz
librambutan-b2dd49c3141d8a21a4e7c7ef51dee7329f847c30.zip
FSMC tweaks
-rw-r--r--examples/test-fsmc.cpp10
-rw-r--r--libmaple/fsmc.c3
2 files changed, 5 insertions, 8 deletions
diff --git a/examples/test-fsmc.cpp b/examples/test-fsmc.cpp
index 6449cfd..f4fd068 100644
--- a/examples/test-fsmc.cpp
+++ b/examples/test-fsmc.cpp
@@ -1,8 +1,6 @@
#include "wirish.h"
#include "fsmc.h"
-#include "rcc.h"
-#include "gpio.h"
#define LED_PIN 23 // hack for maple native
#define DISC_PIN 14 // hack for USB on native
@@ -40,8 +38,6 @@ void setup() {
uint32 id;
scb = (SCB_Reg*)SCB_BASE;
- rcc_enable_clk_fsmc();
-
pinMode(LED_PIN, OUTPUT);
pinMode(DISC_PIN, OUTPUT);
digitalWrite(DISC_PIN,1);
@@ -96,13 +92,11 @@ void loop() {
toggle ^= 1;
delay(1);
- ptr = (uint16*)(0x60000000);
- count = 0;
- for(int i = 0; i<1024; i++) {
+ for(int i = 0; i<100; i++) { // modify this to speed things up
count++;
ptr++;
- *ptr = (0x0000FFFF & count);
//delay(10); // tweak this to test SRAM resiliance over time
+ *ptr = (0x0000FFFF & count);
if(*ptr != (0x0000FFFF & count)) {
Serial1.println("ERROR: mismatch, halting");
while(1) { }
diff --git a/libmaple/fsmc.c b/libmaple/fsmc.c
index 4e25ef6..a8df2e1 100644
--- a/libmaple/fsmc.c
+++ b/libmaple/fsmc.c
@@ -88,6 +88,9 @@ void fsmc_native_sram_init(void) {
gpio_set_mode(GPIOE_BASE, 0, MODE_AF_OUTPUT_PP); // NBL0
gpio_set_mode(GPIOE_BASE, 1, MODE_AF_OUTPUT_PP); // NBL1
+
+ // Next enable the clock
+ rcc_enable_clk_fsmc();
// Then we configure channel 1 the FSMC SRAM peripheral
// (all SRAM channels are in "Bank 1" of the FSMC)