Stellaris® LM4F120 LaunchPad
De Wiki LOGre
Révision de 19 juin 2015 à 11:01 par Quicky (discuter | contributions)
La bête
- Quelques chiffres : ARM Cortex M4F à 80 MHz, 32 Ko de SRAM, 256 Ko de Flash, 2 boutons, 2 ports USB (host et device resp.)
- schéma : http://www.ti.com/ds_dgm/images/fbd_spms294d.gif
- Page web : http://www.ti.com/ww/en/launchpad/stellaris_head.html?DCMP=stellaris-launchpad&HQS=stellaris-launchpad-b
- User Manual : http://openwrt.metaverse.fr/stellaris/spmu289.pdf
- Datasheet du microcontroleur Cortex M4F : http://openwrt.metaverse.fr/stellaris/lm4f120h5qr.pdf
Logiciels
- SW-LM3S: StellarisWare® Complete (all boards, all components) : http://openwrt.metaverse.fr/stellaris/SW-LM3S-9453.exe (Librairies de base, examples)
- EK-LM4F120XL-CCS: Composer Studio for the Stellaris LM4F120 LaunchPad : http://openwrt.metaverse.fr/stellaris/EK-LM4F120XL-CCS-733.zip (IDE Eclipse, Cygwin, toolchain ARM Cortex M4F)
Ressources
- http://www.ti.com/lsds/ti/tools-software/libraries.page
- http://www.ti.com/tool/ek-lm4f120xl
- http://hackaday.com/tag/stellaris/
- Wiki TI : http://processors.wiki.ti.com/index.php/Stellaris_LaunchPad [1]
- Toolchain linux : http://recursive-labs.com/blog/2012/10/28/stellaris-launchpad-gnu-linux-getting-started/
- Les projets du Log sur le LaunchPad
- Projets externes:
- BoosterPack LED8x8 : http://www.euphonistihack.blogspot.fr/2012/08/the-writeup.html
- Faire son propre BoosterPack : http://processors.wiki.ti.com/index.php/BYOB
- PWM : http://codeandlife.com/2012/10/30/stellaris-launchpad-pwm-tutorial/
Pour commencer
Déja, il vous faut l'environnement de dev, c'est ici !
- Sous Windows et avec l'IDE Code Composer Studio
- Sous Windows mais sans l'IDE Code Composer Studio
- Sous Linux
Un fois l'environnement de dev opérationnel, voici le projet zero et le Hello World que vous pouvez compielr et flasher, histoire de commencer avec quelque chose ! Le tuto est dispo sur le wiki de TI [1] et fait parti du paquet StellarisWare (StellarisWare/boards/ek-lm4f120xl/project0)
Project0
//***************************************************************************** // // project0.c - Example to demonstrate minimal StellarisWare setup // // Copyright (c) 2012 Texas Instruments Incorporated. All rights reserved. // Software License Agreement // // Texas Instruments (TI) is supplying this software for use solely and // exclusively on TI's microcontroller products. The software is owned by // TI and/or its suppliers, and is protected under applicable copyright // laws. You may not combine this software with "viral" open-source // software in order to form a larger program. // // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL // DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 9453 of the EK-LM4F120XL Firmware Package. // //***************************************************************************** #include "inc/hw_types.h" #include "inc/hw_memmap.h" #include "driverlib/sysctl.h" #include "driverlib/gpio.h" //***************************************************************************** // // Define pin to LED color mapping. // //***************************************************************************** #define RED_LED GPIO_PIN_1 #define BLUE_LED GPIO_PIN_2 #define GREEN_LED GPIO_PIN_3 //***************************************************************************** // //! \addtogroup example_list //! <h1>Project Zero (project0)</h1> //! //! This example demonstrates the use of StellarisWare to setup the clocks //! and toggle GPIO pins to make the LED's blink. This is a good place to //! start understanding your launchpad and the tools that can be used to //! program it. See http://www.ti.com/stellaris-launchpad/project0 for more //! information and tutorial videos. //! // //***************************************************************************** //***************************************************************************** // // Main 'C' Language entry point. Toggle an LED using StellarisWare. // See www.ti.com/stellaris-launchpad/project0 for more information and // tutorial videos. // //***************************************************************************** int main(void) { // // Setup the system clock to run at 50 Mhz from PLL with crystal reference // SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ| SYSCTL_OSC_MAIN); // // Enable and configure the GPIO port for the LED operation. // SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, RED_LED|BLUE_LED|GREEN_LED); // // Loop Forever // while(1) { // // Turn on the LED // GPIOPinWrite(GPIO_PORTF_BASE, RED_LED|BLUE_LED|GREEN_LED, RED_LED); // // Delay for a bit // SysCtlDelay(2000000); // // Turn on the LED // GPIOPinWrite(GPIO_PORTF_BASE, RED_LED|BLUE_LED|GREEN_LED, BLUE_LED); // // Delay for a bit // SysCtlDelay(2000000); } }
Hello World
//***************************************************************************** // // hello.c - Simple hello world example. // // Copyright (c) 2012 Texas Instruments Incorporated. All rights reserved. // Software License Agreement // // Texas Instruments (TI) is supplying this software for use solely and // exclusively on TI's microcontroller products. The software is owned by // TI and/or its suppliers, and is protected under applicable copyright // laws. You may not combine this software with "viral" open-source // software in order to form a larger program. // // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL // DAMAGES, FOR ANY REASON WHATSOEVER. // // This is part of revision 9453 of the EK-LM4F120XL Firmware Package. // //***************************************************************************** #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/debug.h" #include "driverlib/fpu.h" #include "driverlib/gpio.h" #include "driverlib/pin_map.h" #include "driverlib/rom.h" #include "driverlib/sysctl.h" #include "utils/uartstdio.h" //***************************************************************************** // //! \addtogroup example_list //! <h1>Hello World (hello)</h1> //! //! A very simple ``hello world'' example. It simply displays ``Hello World!'' //! on the UART and is a starting point for more complicated applications. //! //! UART0, connected to the Stellaris Virtual Serial Port and running at //! 115,200, 8-N-1, is used to display messages from this application. // //***************************************************************************** //***************************************************************************** // // The error routine that is called if the driver library encounters an error. // //***************************************************************************** #ifdef DEBUG void __error__(char *pcFilename, unsigned long ulLine) { } #endif //***************************************************************************** // // Print "Hello World!" to the UART on the Stellaris evaluation board. // //***************************************************************************** int main(void) { volatile unsigned long ulLoop; // // Enable lazy stacking for interrupt handlers. This allows floating-point // instructions to be used within interrupt handlers, but at the expense of // extra stack usage. // ROM_FPULazyStackingEnable(); // // Set the clocking to run directly from the crystal. // ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN); // // Enable the GPIO port that is used for the on-board LED. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); // // Enable the GPIO pins for the LED (PF2 & PF3). // ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2); // // Initialize the UART. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); ROM_GPIOPinConfigure(GPIO_PA0_U0RX); ROM_GPIOPinConfigure(GPIO_PA1_U0TX); ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); UARTStdioInit(0); // // Hello! // UARTprintf("Hello, world!\n"); // // We are finished. Hang around doing nothing. // while(1) { // // Turn on the BLUE LED. // GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2); // // Delay for a bit. // SysCtlDelay(SysCtlClockGet() / 10 / 3); // // Turn off the BLUE LED. // GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0); // // Delay for a bit. // SysCtlDelay(SysCtlClockGet() / 10 / 3); } }