From 0a32db5e05321ed9272a7c073b1f5a7ad12f2126 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 31 Jul 2013 11:44:30 -0600 Subject: [PATCH] SAMA5: Delay loop calibrated; Correct sense of the RED LED --- configs/sama5d3x-ek/README.txt | 43 +++++++++++++++++++++----- configs/sama5d3x-ek/hello/defconfig | 2 +- configs/sama5d3x-ek/include/board.h | 2 +- configs/sama5d3x-ek/norboot/defconfig | 2 +- configs/sama5d3x-ek/nsh/defconfig | 2 +- configs/sama5d3x-ek/ostest/defconfig | 2 +- configs/sama5d3x-ek/src/sam_autoleds.c | 13 ++++---- configs/sama5d3x-ek/src/sam_userleds.c | 11 ++++++- configs/sama5d3x-ek/src/sama5d3x-ek.h | 4 +-- 9 files changed, 59 insertions(+), 22 deletions(-) diff --git a/configs/sama5d3x-ek/README.txt b/configs/sama5d3x-ek/README.txt index 901c052591..b408f3549d 100644 --- a/configs/sama5d3x-ek/README.txt +++ b/configs/sama5d3x-ek/README.txt @@ -449,7 +449,7 @@ Buttons and LEDs PE24. The red LED is also pulled high but is driven by a transistor so that it is illuminated when power is applied even if PE24 is not configured as an output. If PE24 is configured as an output, then the - LCD is illuminated by a low output. + LCD is illuminated by a high output. These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is defined. In that case, the usage by the board port is defined in @@ -772,8 +772,14 @@ Configurations CONFIG_BOOT_RUNFROMISRAM=y : Run from internal SRAM STATUS: + 2013-7-19: This configuration (as do the others) run at 396MHz. + The SAMA5D3 can run at 536MHz. I still need to figure out the + PLL settings to get that speed. + 2013-7-28: This configuration was verified functional. + 2013-7-31: Delay loop calibrated. + norboot: This is a little program to help debug of code in NOR flash. It does the following: @@ -788,6 +794,13 @@ Configurations 1. This program derives from the hello configuration. All of the notes there apply to this configuration as well. + STATUS: + 2013-7-19: This configuration (as do the others) run at 396MHz. + The SAMA5D3 can run at 536MHz. I still need to figure out the + PLL settings to get that speed. + + 2013-7-31: Delay loop calibrated. + nsh: This configuration directory provide the NuttShell (NSH). @@ -833,13 +846,22 @@ Configurations However, no built-in applications are selected in the base configuration. STATUS: + 2013-7-19: This configuration (as do the others) run at 396MHz. + The SAMA5D3 can run at 536MHz. I still need to figure out the + PLL settings to get that speed. + 2013-7-31: I have been unable to execute this configuration from NOR FLASH by closing the BMS jumper (J9). As far as I can tell, this jumper does nothing on my board??? I have been using the norboot configuration to start the program in NOR FLASH (see just above). See "Creating and Using NORBOOT" above. + 2013-7-31: This NSH configuration appears to be fully functional. + 2013-7-31: Using delay loop calibration from the hello configuration. + That configuration runs out of internal SRAM and, as a result, this + configuration needs to be recalibrated. + ostest: This configuration directory, performs a simple OS test using examples/ostest. @@ -883,15 +905,22 @@ Configurations BMS jumper. STATUS: + 2013-7-19: This configuration (as do the others) run at 396MHz. + The SAMA5D3 can run at 536MHz. I still need to figure out the + PLL settings to get that speed. + 2013-7-30: I have been unable to execute this configuration from NOR FLASH by closing the BMS jumper (J9). As far as I can tell, this jumper does nothing on my board??? I have been using the norboot configuration to start the program in NOR FLASH (see just above). See "Creating and Using NORBOOT" above. - 2013-7-31: - The OS test configuration is basically functional, but takes a very - long time in the round-robin scheduler test computing prime numbers. - This test is suppose to be slow -- like several seconds -- but not - many minutes. No idea why yet. The best guess would be an excessive - number of context switches. + 2013-7-31: The OS test configuration is basically functional, but + takes a very long time in the round-robin scheduler test computing + prime numbers. This test is supposed to be slow -- like several + seconds -- but not many minutes. No idea why yet. The best guess + would be an excessive number of context switches. + + 2013-7-31: Using delay loop calibration from the hello configuration. + That configuration runs out of internal SRAM and, as a result, this + configuration needs to be recalibrated. diff --git a/configs/sama5d3x-ek/hello/defconfig b/configs/sama5d3x-ek/hello/defconfig index 274565187f..b047352fad 100644 --- a/configs/sama5d3x-ek/hello/defconfig +++ b/configs/sama5d3x-ek/hello/defconfig @@ -197,7 +197,7 @@ CONFIG_ARCH_STACKDUMP=y # # Board Settings # -CONFIG_BOARD_LOOPSPERMSEC=16717 +CONFIG_BOARD_LOOPSPERMSEC=49341 # CONFIG_ARCH_CALIBRATION is not set CONFIG_RAM_START=0x00300000 CONFIG_RAM_VSTART=0x00300000 diff --git a/configs/sama5d3x-ek/include/board.h b/configs/sama5d3x-ek/include/board.h index 0c6900d9e6..fd6470e347 100644 --- a/configs/sama5d3x-ek/include/board.h +++ b/configs/sama5d3x-ek/include/board.h @@ -156,7 +156,7 @@ * PE24. The red LED is also pulled high but is driven by a transistor so * that it is illuminated when power is applied even if PE24 is not * configured as an output. If PE24 is configured as an output, then the - * LCD is illuminated by a low output. + * LCD is illuminated by a high output. */ /* LED index values for use with sam_setled() */ diff --git a/configs/sama5d3x-ek/norboot/defconfig b/configs/sama5d3x-ek/norboot/defconfig index c61264255b..92cb7bbc07 100644 --- a/configs/sama5d3x-ek/norboot/defconfig +++ b/configs/sama5d3x-ek/norboot/defconfig @@ -207,7 +207,7 @@ CONFIG_ARCH_STACKDUMP=y # # Board Settings # -CONFIG_BOARD_LOOPSPERMSEC=16717 +CONFIG_BOARD_LOOPSPERMSEC=49341 # CONFIG_ARCH_CALIBRATION is not set CONFIG_ARCH_HAVE_INTERRUPTSTACK=y CONFIG_ARCH_INTERRUPTSTACK=0 diff --git a/configs/sama5d3x-ek/nsh/defconfig b/configs/sama5d3x-ek/nsh/defconfig index 0c8d50b876..adeca99250 100644 --- a/configs/sama5d3x-ek/nsh/defconfig +++ b/configs/sama5d3x-ek/nsh/defconfig @@ -208,7 +208,7 @@ CONFIG_ARCH_STACKDUMP=y # # Board Settings # -CONFIG_BOARD_LOOPSPERMSEC=16717 +CONFIG_BOARD_LOOPSPERMSEC=49341 # CONFIG_ARCH_CALIBRATION is not set CONFIG_ARCH_HAVE_INTERRUPTSTACK=y CONFIG_ARCH_INTERRUPTSTACK=0 diff --git a/configs/sama5d3x-ek/ostest/defconfig b/configs/sama5d3x-ek/ostest/defconfig index 5d1010ad1c..8262ee7dda 100644 --- a/configs/sama5d3x-ek/ostest/defconfig +++ b/configs/sama5d3x-ek/ostest/defconfig @@ -208,7 +208,7 @@ CONFIG_ARCH_STACKDUMP=y # # Board Settings # -CONFIG_BOARD_LOOPSPERMSEC=16717 +CONFIG_BOARD_LOOPSPERMSEC=49341 # CONFIG_ARCH_CALIBRATION is not set CONFIG_ARCH_HAVE_INTERRUPTSTACK=y CONFIG_ARCH_INTERRUPTSTACK=0 diff --git a/configs/sama5d3x-ek/src/sam_autoleds.c b/configs/sama5d3x-ek/src/sam_autoleds.c index 1fdc6f6ae0..da56cde6e4 100644 --- a/configs/sama5d3x-ek/src/sam_autoleds.c +++ b/configs/sama5d3x-ek/src/sam_autoleds.c @@ -131,8 +131,8 @@ void up_ledinit(void) void up_ledon(int led) { - bool blueoff = true; - bool redoff = true; + bool blueoff = true; /* Low illuminates */ + bool redon = false; /* High illuminates */ switch (led) { @@ -148,13 +148,12 @@ void up_ledon(int led) return; case 3: /* LED_PANIC */ - redoff = false; + redon = true; break; } sam_gpiowrite(GPIO_BLUE, blueoff); - sam_gpiowrite(GPIO_RED, redoff); - + sam_gpiowrite(GPIO_RED, redon); } /**************************************************************************** @@ -165,8 +164,8 @@ void up_ledoff(int led) { if (led != 2) { - sam_gpiowrite(GPIO_BLUE, true); - sam_gpiowrite(GPIO_RED, true); + sam_gpiowrite(GPIO_BLUE, true); /* Low illuminates */ + sam_gpiowrite(GPIO_RED, false); /* High illuminates */ } } diff --git a/configs/sama5d3x-ek/src/sam_userleds.c b/configs/sama5d3x-ek/src/sam_userleds.c index 725f64abe5..21d5b04b4e 100644 --- a/configs/sama5d3x-ek/src/sam_userleds.c +++ b/configs/sama5d3x-ek/src/sam_userleds.c @@ -122,10 +122,15 @@ void sam_setled(int led, bool ledon) if (led == BOARD_BLUE) { + /* Low illuminates */ + ledcfg = GPIO_BLUE; + ledon = !ledon; } else if (led == BOARD_RED) { + /* High illuminates */ + ledcfg = GPIO_RED; } else @@ -144,9 +149,13 @@ void sam_setleds(uint8_t ledset) { bool ledon; - ledon = ((ledset & BOARD_BLUE_BIT) != 0); + /* Low illuminates */ + + ledon = ((ledset & BOARD_BLUE_BIT) == 0); sam_gpiowrite(GPIO_BLUE, ledon); + /* High illuminates */ + ledon = ((ledset & BOARD_RED_BIT) != 0); sam_gpiowrite(GPIO_RED, ledon); } diff --git a/configs/sama5d3x-ek/src/sama5d3x-ek.h b/configs/sama5d3x-ek/src/sama5d3x-ek.h index adcfa0a274..7c9c45f060 100644 --- a/configs/sama5d3x-ek/src/sama5d3x-ek.h +++ b/configs/sama5d3x-ek/src/sama5d3x-ek.h @@ -65,12 +65,12 @@ * PE24. The red LED is also pulled high but is driven by a transistor so * that it is illuminated when power is applied even if PE24 is not * configured as an output. If PE24 is configured as an output, then the - * LCD is illuminated by a low output. + * LCD is illuminated by a high output. */ #define GPIO_BLUE (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_SET | \ GPIO_PORT_PIOE | GPIO_PIN25) -#define GPIO_RED (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_SET | \ +#define GPIO_RED (GPIO_OUTPUT | GPIO_CFG_PULLUP | GPIO_OUTPUT_CLEAR | \ GPIO_PORT_PIOE | GPIO_PIN24) /* Buttons **************************************************************************/