Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by Bernard

  1. Bernard

    dtostrf in Energia

    Hi, I am sorry and apologize for that, I was not clear enough . Sending a string is ok . Thank you -Bernard
  2. Bernard

    dtostrf in Energia

    hi, Thank you for code.. it works ok but when i use it in this code : /* Stellaris LM4F */ #include <Enrf24.h> #include <nRF24L01.h> #include <string.h> #include <SPI.h> Enrf24 radio(PA_5,PA_6,PA_7); // CE, CSN, IRQ + SCK/MOSI/MISO ==> PB_4/PB_7/PB_6 char str[5]; char txaddr[] = {'d','e','v','-','0'}; //int intvar; const char *str_on = "OK"; //void dump_radio_status_to_serialport(uint8_t); void setup() { Serial.begin(9600); SPI.setModule(2); // SPI 2 SPI.begin(); SPI.setDataMode(SPI_MODE0); SPI.setBitOrder(1); radio.begin(); // Defaults 1Mbps, channel 0, max TX power //dump_radio_status_to_serialport(radio.radioState()); radio.setTXaddress((void*)txaddr); } void loop() { sprintf(str, "%.4f", PI); radio.print(str); radio.flush(); // Force transmit (don't wait for any more data) delay(500); } Nothing on the receiver side. Google didn't help me ..... Thank you Salutations -Bernard
  3. Bernard

    dtostrf in Energia

    Hi, Thank you very much spirilis and Energia Salutations
  4. Bernard

    dtostrf in Energia

    Hi, same problem here ... dtostrf is ok on arduino as a newbee I would be happy to get information Thank you
  5. Bernard

    Using Hardware PWM on Tiva Launchpad

    Hello, Thank you Gonya707 I know this way of getting pwm on energia but I wanted to use pwm capability of TM4C123GH6PM. I am sure it is possible but I am not skilled enough to deal with, although I learn every day . so far I get a white LED ( mix of rgb ) May be the clock speed ... I wonder if clock speed (80 Mhz) can be changed on Energia . Salutations.
  6. Bernard

    Using Hardware PWM on Tiva Launchpad

    hi, Thanks gonya707 but I don't use CCS. Just trying to port your example to Energia. happy Christmas Bernard.
  7. Bernard

    Using Hardware PWM on Tiva Launchpad

    Hi again, Just put #define PART_TM4C123GH6PM before #includes. It compiles and load but no pwm effect ....
  8. Bernard

    Using Hardware PWM on Tiva Launchpad

    Hi, I tried porting it to Energia TIVA board : #include <stdint.h> #include <stdbool.h> #include "inc/hw_gpio.h" #include "inc/hw_types.h" #include "inc/hw_memmap.h" #include "driverlib/sysctl.h" #include "driverlib/pin_map.h" #include "driverlib/gpio.h" #include "driverlib/pwm.h" #include "inc/tm4c123gh6pm.h" //added void setup() { unsigned long ulPeriod; //Set the clock SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); //Configure PWM Clock to match system SysCtlPWMClockSet(SYSCTL_PWMDIV_1); // Enable the peripherals used by this program. SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM1); //The Tiva Launchpad has two modules (0 and 1). Module 1 covers the LED pins ulPeriod = SysCtlClockGet() / 200; //PWM frequency 200HZ //Configure PF1,PF2,PF3 Pins as PWM GPIOPinConfigure(GPIO_PF1_M1PWM5); GPIOPinConfigure(GPIO_PF2_M1PWM6); GPIOPinConfigure(GPIO_PF3_M1PWM7); GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3); //Configure PWM Options //PWM_GEN_2 Covers M1PWM4 and M1PWM5 //PWM_GEN_3 Covers M1PWM6 and M1PWM7 See page 207 4/11/13 DriverLib doc PWMGenConfigure(PWM1_BASE, PWM_GEN_2, PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_NO_SYNC); PWMGenConfigure(PWM1_BASE, PWM_GEN_3, PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_NO_SYNC); //Set the Period (expressed in clock ticks) PWMGenPeriodSet(PWM1_BASE, PWM_GEN_2, ulPeriod); PWMGenPeriodSet(PWM1_BASE, PWM_GEN_3, ulPeriod); //Set PWM duty-50% (Period /2) PWMPulseWidthSet(PWM1_BASE, PWM_OUT_5,ulPeriod/2); PWMPulseWidthSet(PWM1_BASE, PWM_OUT_6,ulPeriod/2); PWMPulseWidthSet(PWM1_BASE, PWM_OUT_7,ulPeriod/2); // Enable the PWM generator PWMGenEnable(PWM1_BASE, PWM_GEN_2); PWMGenEnable(PWM1_BASE, PWM_GEN_3); // Turn on the Output pins PWMOutputState(PWM1_BASE, PWM_OUT_5_BIT |PWM_OUT_6_BIT|PWM_OUT_7_BIT, true); } void loop() { } I get errors: pwmtiva.ino:28:22: error: 'GPIO_PF1_M1PWM5' was not declared in this scope apwmtiva.ino:29:22: error: 'GPIO_PF2_M1PWM6' was not declared in this scope apwmtiva.ino:30:22: error: 'GPIO_PF3_M1PWM7' was not declared in this scope I don't understand because GPIO_PF1_M1PWM5, GPIO_PF1_M1PWM6, GPIO_PF1_M1PWM7 are defined in driverlib/pin_map.h. Thanks for help. Salutations. Bernard
  9. Bernard

    AD9850 with Energia

    Hi, Thank you Brainwash for this piece of code. I am trying to port it on MSP430F5529 but I get this error: error: 'strtod' was not declared in this scope any help would be appreciated Salutations Bernard
  10. Hello, I have got same problems using TimerIntRegister ( strange behavior) I use another way for interrupts Ino file /** * LM4F120 - timer based **/ #include "timer_0.h" #include "driverlib/sysctl.h" volatile int8_t isrFlag; void setup(){ noInterrupts(); Serial.begin(9600); pinMode(RED_LED, OUTPUT); interrupts(); initTimer(10); } //********************************************************************* void loop() { const char *dbuf = "12"; if ( isrFlag == 1 ) { noInterrupts(); isrFlag = 0 ; Serial.println(atoi(dbuf)); interrupts(); } } //*********************************************************************** timer_0.h #ifdef __cplusplus extern "C" { #endif void initTimer(unsigned f); void Timer0IntHandler(void); #ifdef __cplusplus } #endif timer_0.c /* * timer_0.c */ #include "Energia.h" #include "inc/hw_ints.h" #include "driverlib/interrupt.h" #include "driverlib/sysctl.h" #include "driverlib/timer.h" #include "timer_0.h" extern volatile int8_t isrFlag; void initTimer(unsigned f) { unsigned long ulPeriod = (SysCtlClockGet() / f) / 2; ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); ROM_TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC); ROM_TimerLoadSet(TIMER0_BASE, TIMER_A, ulPeriod -1); ROM_IntEnable(INT_TIMER0A); ROM_TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT); ROM_TimerEnable(TIMER0_BASE, TIMER_A); } void Timer0IntHandler() { // Clear the timer interrupt ROM_TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT); digitalWrite(RED_LED, digitalRead(RED_LED) ^ 1);// toggle LED pin isrFlag =1; } startup_gcc.c //***************************************************************************** // // startup_gcc.c - Startup code for use with GNU tools. // // Copyright (c) 2009-2012 Texas Instruments Incorporated. All rights reserved. // Software License Agreement // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // //***************************************************************************** #include "Energia.h" #include "inc/hw_types.h" #include "inc/hw_nvic.h" //***************************************************************************** // // Forward declaration of the default fault handlers. // //***************************************************************************** void ResetISR(void); static void NmiSR(void); static void FaultISR(void); static void IntDefaultHandler(void); //***************************************************************************** // // The entry point for the application. // //***************************************************************************** extern int main(void); extern void GPIOAIntHandler(void); extern void GPIOBIntHandler(void); extern void GPIOCIntHandler(void); extern void GPIODIntHandler(void); extern void GPIOEIntHandler(void); extern void GPIOFIntHandler(void); /* * create some overridable default signal handlers */ __attribute__((weak)) void UARTIntHandler(void) {} __attribute__((weak)) void ToneIntHandler(void) {} __attribute__((weak)) void I2CIntHandler(void) {} __attribute__((weak)) extern void Timer0IntHandler(void) {} __attribute__((weak)) extern void ADC0IntHandler(void) {} //***************************************************************************** // System stack start determined by ldscript, normally highest ram address //***************************************************************************** extern unsigned _estack; //***************************************************************************** // // The vector table. Note that the proper constructs must be placed on this to // ensure that it ends up at physical address 0x0000.0000. // //***************************************************************************** __attribute__ ((section(".isr_vector"))) void (* const g_pfnVectors[])(void) = { (void *)&_estack, // The initial stack pointer, 0x20008000 32K ResetISR, // The reset handler NmiSR, // The NMI handler FaultISR, // The hard fault handler IntDefaultHandler, // The MPU fault handler IntDefaultHandler, // The bus fault handler IntDefaultHandler, // The usage fault handler 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved IntDefaultHandler, // SVCall handler IntDefaultHandler, // Debug monitor handler 0, // Reserved IntDefaultHandler, // The PendSV handler IntDefaultHandler, // The SysTick handler GPIOAIntHandler, // GPIO Port A GPIOBIntHandler, // GPIO Port B GPIOCIntHandler, // GPIO Port C GPIODIntHandler, // GPIO Port D GPIOEIntHandler, // GPIO Port E UARTIntHandler, // UART0 Rx and Tx UARTIntHandler, // UART1 Rx and Tx IntDefaultHandler, // SSI0 Rx and Tx I2CIntHandler, // I2C0 Master and Slave IntDefaultHandler, // PWM Fault IntDefaultHandler, // PWM Generator 0 IntDefaultHandler, // PWM Generator 1 IntDefaultHandler, // PWM Generator 2 IntDefaultHandler, // Quadrature Encoder 0 IntDefaultHandler, // ADC Sequence 0 IntDefaultHandler, // ADC Sequence 1 IntDefaultHandler, // ADC Sequence 2 ADC0IntHandler, // ADC Sequence 3 IntDefaultHandler, // Watchdog timer Timer0IntHandler, // Timer 0 subtimer A IntDefaultHandler, // Timer 0 subtimer B IntDefaultHandler, // Timer 1 subtimer A IntDefaultHandler, // Timer 1 subtimer B IntDefaultHandler, // Timer 2 subtimer A IntDefaultHandler, // Timer 2 subtimer B IntDefaultHandler, // Analog Comparator 0 IntDefaultHandler, // Analog Comparator 1 IntDefaultHandler, // Analog Comparator 2 IntDefaultHandler, // System Control (PLL, OSC, BO) IntDefaultHandler, // FLASH Control GPIOFIntHandler, // GPIO Port F IntDefaultHandler, // GPIO Port G IntDefaultHandler, // GPIO Port H UARTIntHandler, // UART2 Rx and Tx IntDefaultHandler, // SSI1 Rx and Tx IntDefaultHandler, // Timer 3 subtimer A IntDefaultHandler, // Timer 3 subtimer B I2CIntHandler, // I2C1 Master and Slave IntDefaultHandler, // Quadrature Encoder 1 IntDefaultHandler, // CAN0 IntDefaultHandler, // CAN1 IntDefaultHandler, // CAN2 IntDefaultHandler, // Ethernet IntDefaultHandler, // Hibernate IntDefaultHandler, // USB0 IntDefaultHandler, // PWM Generator 3 IntDefaultHandler, // uDMA Software Transfer IntDefaultHandler, // uDMA Error IntDefaultHandler, // ADC1 Sequence 0 IntDefaultHandler, // ADC1 Sequence 1 IntDefaultHandler, // ADC1 Sequence 2 IntDefaultHandler, // ADC1 Sequence 3 IntDefaultHandler, // I2S0 IntDefaultHandler, // External Bus Interface 0 IntDefaultHandler, // GPIO Port J IntDefaultHandler, // GPIO Port K IntDefaultHandler, // GPIO Port L IntDefaultHandler, // SSI2 Rx and Tx IntDefaultHandler, // SSI3 Rx and Tx UARTIntHandler, // UART3 Rx and Tx UARTIntHandler, // UART4 Rx and Tx UARTIntHandler, // UART5 Rx and Tx UARTIntHandler, // UART6 Rx and Tx UARTIntHandler, // UART7 Rx and Tx 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved I2CIntHandler, // I2C2 Master and Slave I2CIntHandler, // I2C3 Master and Slave ToneIntHandler, // Timer 4 subtimer A IntDefaultHandler, // Timer 4 subtimer B 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved IntDefaultHandler, // Timer 5 subtimer A IntDefaultHandler, // Timer 5 subtimer B IntDefaultHandler, // Wide Timer 0 subtimer A IntDefaultHandler, // Wide Timer 0 subtimer B IntDefaultHandler, // Wide Timer 1 subtimer A IntDefaultHandler, // Wide Timer 1 subtimer B IntDefaultHandler, // Wide Timer 2 subtimer A IntDefaultHandler, // Wide Timer 2 subtimer B IntDefaultHandler, // Wide Timer 3 subtimer A IntDefaultHandler, // Wide Timer 3 subtimer B IntDefaultHandler, // Wide Timer 4 subtimer A IntDefaultHandler, // Wide Timer 4 subtimer B IntDefaultHandler, // Wide Timer 5 subtimer A IntDefaultHandler, // Wide Timer 5 subtimer B IntDefaultHandler, // FPU IntDefaultHandler, // PECI 0 IntDefaultHandler, // LPC 0 IntDefaultHandler, // I2C4 Master and Slave IntDefaultHandler, // I2C5 Master and Slave IntDefaultHandler, // GPIO Port M IntDefaultHandler, // GPIO Port N IntDefaultHandler, // Quadrature Encoder 2 IntDefaultHandler, // Fan 0 0, // Reserved IntDefaultHandler, // GPIO Port P (Summary or P0) IntDefaultHandler, // GPIO Port P1 IntDefaultHandler, // GPIO Port P2 IntDefaultHandler, // GPIO Port P3 IntDefaultHandler, // GPIO Port P4 IntDefaultHandler, // GPIO Port P5 IntDefaultHandler, // GPIO Port P6 IntDefaultHandler, // GPIO Port P7 IntDefaultHandler, // GPIO Port Q (Summary or Q0) IntDefaultHandler, // GPIO Port Q1 IntDefaultHandler, // GPIO Port Q2 IntDefaultHandler, // GPIO Port Q3 IntDefaultHandler, // GPIO Port Q4 IntDefaultHandler, // GPIO Port Q5 IntDefaultHandler, // GPIO Port Q6 IntDefaultHandler, // GPIO Port Q7 IntDefaultHandler, // GPIO Port R IntDefaultHandler, // GPIO Port S IntDefaultHandler, // PWM 1 Generator 0 IntDefaultHandler, // PWM 1 Generator 1 IntDefaultHandler, // PWM 1 Generator 2 IntDefaultHandler, // PWM 1 Generator 3 IntDefaultHandler // PWM 1 Fault }; //***************************************************************************** // // The following are constructs created by the linker, indicating where the // the "data" and "bss" segments reside in memory. The initializers for the // for the "data" segment resides immediately following the "text" segment. // //***************************************************************************** extern unsigned long _etext; extern unsigned long _data; extern unsigned long _edata; extern unsigned long _bss; extern unsigned long _ebss; extern void (*__preinit_array_start[])(void); extern void (*__preinit_array_end[])(void); extern void (*__init_array_start[])(void); extern void (*__init_array_end[])(void); //***************************************************************************** // // This is the code that gets called when the processor first starts execution // following a reset event. Only the absolutely necessary set is performed, // after which the application supplied entry() routine is called. Any fancy // actions (such as making decisions based on the reset cause register, and // resetting the bits in that register) are left solely in the hands of the // application. // //***************************************************************************** void ResetISR(void) { unsigned long *pulSrc, *pulDest; unsigned i, cnt; // // Copy the data segment initializers from flash to SRAM. // pulSrc = &_etext; for (pulDest = &_data; pulDest < &_edata;) { *pulDest++ = *pulSrc++; } // // Zero fill the bss segment. // __asm( " ldr r0, =_bss\n" " ldr r1, =_ebss\n" " mov r2, #0\n" " .thumb_func\n" "1:\n" " cmp r0, r1\n" " it lt\n" " strlt r2, [r0], #4\n" " blt 1b" ); (void)_bss; (void)_ebss; // get rid of unused warnings // // Enable the floating-point unit before calling c++ ctors // HWREG(NVIC_CPAC) = ((HWREG(NVIC_CPAC) & ~(NVIC_CPAC_CP10_M | NVIC_CPAC_CP11_M)) | NVIC_CPAC_CP10_FULL | NVIC_CPAC_CP11_FULL); // // call any global c++ ctors // cnt = __preinit_array_end - __preinit_array_start; for (i = 0; i < cnt; i++) __preinit_array_start[i](); cnt = __init_array_end - __init_array_start; for (i = 0; i < cnt; i++) __init_array_start[i](); // // call 'C' entry point, Energia never returns from main // main(); } void *__dso_handle = 0; /** * _sbrk - newlib memory allocation routine */ typedef char *caddr_t; caddr_t _sbrk (int incr) { double current_sp; extern char end asm ("end"); /* Defined by linker */ static char * heap_end; char * prev_heap_end; if (heap_end == NULL) { heap_end = &end; /* first ram address after bss and data */ } prev_heap_end = heap_end; // simplistic approach to prevent the heap from corrupting the stack // TBD: review for alternatives if ( heap_end + incr < (caddr_t)&current_sp ) { heap_end += incr; return (caddr_t) prev_heap_end; } else { return NULL; } } //***************************************************************************** // // This is the code that gets called when the processor receives a NMI. This // simply enters an infinite loop, preserving the system state for examination // by a debugger. // //***************************************************************************** static void NmiSR(void) { // // Enter an infinite loop. // while (1) { ; // trap NMI } } //***************************************************************************** // // This is the code that gets called when the processor receives a fault // interrupt. This simply enters an infinite loop, preserving the system state // for examination by a debugger. // //***************************************************************************** static void FaultISR(void) { // // Enter an infinite loop. // while (1) { ; // trap FAULT } } //***************************************************************************** // // This is the code that gets called when the processor receives an unexpected // interrupt. This simply enters an infinite loop, preserving the system state // for examination by a debugger. // //***************************************************************************** static void IntDefaultHandler(void) { // // Go into an infinite loop. // while (1) { ; // trap any handler not defined } } Tested on Windows 7 and Ubuntu 12.04 LTS I can see 12 regards Bernard
  11. Bernard

    Serial1 or SofwareSerial ?

    Hi, I would like to make my Stellaris talking to raspberry pi. On Stellaris side I tried this code : void setup() { unsigned char c = 0; Serial3.begin(9600); Serial3.println("Test starts ... "); while( c != 'U') { if (Serial3.available()) { c = Serial3.read(); delay(200); Serial3.print(c); } } } void loop() { } I get this error message : 'Serial3' was not declared in this scope .. Any help Thank you Regards
  12. Hi, Thanks to patolin my problem is solved
  13. Bernard

    LM4F120 Timer issue

    Hello, First of all I apologize for my broken English. I am a beginner and I am trying to understand some examples from TI workbook. Some examples work but I have problems with the blink timer I ported under Energia. #include "inc/hw_ints.h" #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/sysctl.h" #include "driverlib/interrupt.h" #include "driverlib/gpio.h" #include "driverlib/timer.h" #include"Energia.h" unsigned long ulPeriod; void setup() { //SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3); SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); TimerConfigure(TIMER0_BASE, TIMER_CFG_32_BIT_PER); ulPeriod = (SysCtlClockGet() / 10) / 2; TimerLoadSet(TIMER0_BASE, TIMER_A, ulPeriod -1); IntEnable(INT_TIMER0A); TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT); IntMasterEnable(); TimerEnable(TIMER0_BASE, TIMER_A); } void loop() { } void Timer0IntHandler() { // Clear the timer interrupt TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT); // Read the current state of the GPIO pin and // write back the opposite state if(GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_2)) { GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, 0); } else { GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 4); } } Tried to add in startup_gcc.c : Timer0IntHandler at its right place and : extern void Timer0IntHandler(void); at the top of file. I still am getting the same error message : core.a(startup_gcc.c.o) .isr_vector+0x8c): undefined reference to `Timer0IntHandler' collect2: error: ld returned 1 exit status Any help would be appreciated. Salutations.
  14. Hello, I usually use Energia but I have got a new PC With windows 7 and I would like to use CCS V5. I have downloaded and installed it, installed drivers and Stellaris ware but I am not able to have it working. Is there a tutorial that can help me to set up build and compiler options. I am lost . Thank you very much for your help. Bernard
  15. Bernard

    LM4F120 PWM

    Hi, I have found an excellent tutorial about PWM on Stellarpad that help me to understand . Here is the Energia version : /* PWM * TIMER0 B * PF_1 RED_LED */ #include "inc/hw_memmap.h" #include "driverlib/sysctl.h" #include "driverlib/gpio.h" #include "driverlib/timer.h" unsigned long ulPeriod, dutyCycle; void setup() { ulPeriod = 2000; dutyCycle = 500; // PF_1 on T0CCP1 SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); GPIOPinConfigure(GPIO_PF1_T0CCP1); GPIOPinTypeTimer(GPIO_PORTF_BASE, GPIO_PIN_1); // Timer configuration SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); TimerConfigure(TIMER0_BASE,TIMER_CFG_SPLIT_PAIR|TIMER_CFG_B_PWM); TimerLoadSet(TIMER0_BASE, TIMER_B, ulPeriod -1); TimerMatchSet(TIMER0_BASE, TIMER_B, dutyCycle); TimerEnable(TIMER0_BASE, TIMER_; } void loop() { TimerMatchSet(TIMER0_BASE, TIMER_B, dutyCycle++); if(dutyCycle >= ulPeriod - 1) dutyCycle = 0; delay(1); } // End of .ino file I wanted to share .. it could be usefull for beginers like me. Salutations Bernard
  16. Bernard

    How to come back to IP.Board

    Hello, days ago I switched to IP.Board mobile ( just curious) and I cannot come back to Ip.Board. I haven't found how to do that. some help needed. Thank you Bernard
  17. Hi Robert, Thank you for your comments... looking forward for information. Bernard
  18. Bernard

    Energia error

    Hello, Tell us more about what is going wrong. Post code that doesn't compile.
  19. Hi, I am wondering what is going wrong with me, I must be the most stupid newbie in the ARM world. Almost 200 views of my topic and no answer to my question ... Regards Bernard
  20. Bernard

    Hardware UART not working in Linux

    hello, I have tried many times to apply the patch on my ubuntu 10.04. I get this: bernard@bernard-laptop:/usr/src/cdcacm-0.1$ sudo su [sudo] password for bernard: root@bernard-laptop:/usr/src/cdcacm-0.1# ./install.sh ERROR: Module cdc_acm does not exist in /proc/modules ERROR: Module cdcacm does not exist in /proc/modules Error! The module cdcacm 0.1 is not currently installed. This module is not currently ACTIVE for kernel 2.6.32-45-generic (i686). ------------------------------ Deleting module version: 0.1 completely from the DKMS tree. ------------------------------ Done. Creating symlink /var/lib/dkms/cdcacm/0.1/source -> /usr/src/cdcacm-0.1 DKMS: add Completed. Kernel preparation unnecessary for this kernel. Skipping... Building module: cleaning build area....(bad exit status: 2) ....(bad exit status: 2)2-45-generic all KVERSION=2.6.32-45-generic Error! Bad return status for module build on kernel: 2.6.32-45-generic (i686) Consult the make.log in the build directory /var/lib/dkms/cdcacm/0.1/build/ for more information. 0 0 ERROR: binary package for cdcacm: 0.1 not found .ko for module cdcacm in the DKMS tree. You must run a dkms build for kernel 2.6.32-45-generic (i686) first. FATAL: Module cdcacm not found. [26691.000327] usb 1-4.2: usbfs: USBDEVFS_CONTROL failed cmd avrdude rqt 64 rq 12 len 128 ret -110 ERROR: modinfo: could not open /var/lib/dkms/cdcacm/0.1/2.6.32-45-generic/i686/module/cdcacm.ko: No such file or directory root@bernard-laptop:/usr/src/cdcacm-0.1# I am stuck and not skilled enough to deal with this error. Regards. Bernard
  21. Bernard

    attachInterrupt on Stellaris Launchpad

    Hi, Sometimes using Arduino doc for Stellaris is confusing. Arduino interrupts are numbered Board int.0 int.1 int.2 int.3 int.4 int.5 Uno, Ethernet 2 3 Mega2560 2 3 21 20 19 18 Leonardo 3 2 0 1 Having a look at WInterrupts.c helped me to understand attachInterrupt function on Stellaris void attachInterrupt(uint8_t interruptNum, void (*userFunc)(void), int mode) uint8_t bit = digitalPinToBitMask(interruptNum); uint8_t port = digitalPinToPort(interruptNum); uint32_t portBase = (uint32_t) portBASERegister(port); So on Stellaris we use pin name. Maybe interruptNum should be replaced by interruptPin ... just a suggestion. That being said I like Energia In the exemple above ( PUSH1, PF_4, 31) refer to the same pin ( see pins_energia.h) Cheers Bernard
  22. Bernard

    attachInterrupt on Stellaris Launchpad

    Hello JCR, Contrary to arduino documentation on Stellaris you can use all GPIO pins as first argument of the "attachinterrupt function" ex: attachInterrupt (PB_3, isrFunction, mode); Here is an example using PUSH1 on PF_4 that toggle RED_LED /* Test interruption et antirebond */ unsigned long DebounceTime; unsigned long LastDebounceTime = 0; volatile int FlagStateRedLed = LOW; volatile int FlagStateGreenLed = LOW; void setup() { Serial.begin(9600); pinMode(RED_LED, OUTPUT); pinMode(PUSH1, INPUT_PULLUP); attachInterrupt(PUSH1, ChangeStateRedLed, FALLING); } void loop() { for (int i = 0; i < 100; i++) { Serial.println(" Waiting for push1 pressed"); delay(10); } } void ChangeStateRedLed() { DebounceTime = millis(); if ( DebounceTime - LastDebounceTime > 200 || DebounceTime < LastDebounceTime) { FlagStateRedLed = !FlagStateRedLed; digitalWrite(RED_LED, FlagStateRedLed); LastDebounceTime = DebounceTime; } } Hope this help Cheers Bernard
  23. Bernard

    How to come back to IP.Board

    Hi, Thank you very much Bluehash .. it is ok
  24. Bernard

    Help me about TIMER

    Hi Trungkiena6, You could download EK-LM4F120XL LaunchPad Workshop Student Guide and Lab Manual from TI site. It includes a nice tutorial for interrupts and the timers. Cheers Bernard