Jump to content

LadyInRed

Members
  • Content Count

    12
  • Joined

  • Last visited

  1. Hi. I try to download a program in microcontroller and i receive the next error : CORTEX_M4_0: Trouble Reading Memory Block at 0x708 on Page 0 of Length 0x18: Debug Port error occurred. CORTEX_M4_0: Error: Debug Port error occurred. I use Tiva C Series LaunchPad EK - TM4C123XGL.
  2. Hi all. First of all i have made a program who blink a led. I use the interrupt of Timer0B interrupt. I enabled this interrupt with this instruction : IntEnable(INT_TIMER0B_BLIZZARD); This interrupt is defined in the header file hw_ints.h : #define INT_TIMER0B_BLIZZARD 36 // 16/32-Bit Timer 0B And program works very well. But now, i want to enable the same interrupt with another instruction : NVIC_EN1 = 0x00000010; In my program the Timer0B interrupt has number 36. in header file hw_nvic.h : #define NVIC_EN1 0xE000E104 // Interrupt 32-54 Set Enable Is the same interrupt ? I receive an error #138 expression must be a modifiable lvalue. An lvalue is an expression to which a value can be assigned. The lvalue expression is located on the left side of an assignment statement, whereas an rvalue is located on the right side of an assignment statement. Each assignment statement must have an lvalue and an rvalue. The lvalue expression must reference a storable variable in memory. It cannot be a constant. Why i receive this error ? Thank you.
  3. Where LED = 0x08; void Timer0BIntHandler() { TimerIntClear(TIMER0_BASE, TIMER_TIMB_TIMEOUT); COUNTER++; GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3, LED); if(COUNTER == NUMBER_OF_INTERRUPTS) { LED ^= 0x08; COUNTER = 0; } }
  4. I found a solution : void Timer0BIntHandler() { TimerIntClear(TIMER0_BASE, TIMER_TIMB_TIMEOUT); COUNTER++; GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3, LED); if(COUNTER == NUMBER_OF_INTERRUPTS) { LED ^= 0x08; COUNTER = 0; } }
  5. Hi. I want to made a simple program who turn on/off a led. In the function below i must use the XOR operator in line : GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3, 8); How can i write the XOR operation ? void Timer0BIntHandler() { TimerIntClear(TIMER0_BASE, TIMER_TIMB_TIMEOUT); counter++; if(counter == NUMBER_OF_INTS) { GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3, 8); counter = 0; } }
  6. Hi. Can someone to recommend me some tutorials about ASM language CCS Stellaris LaunchPad LM4F120H5QR ? Thank you.
  7. Finally works. Thank you for your support. Thank you very much. One more question. In my opinion i think when i created the project i made a mistake. Like you said the driverlib isn't linked. If this file is linked i think is not necessary to made the modifications that you told me. Can you tell me how to do it ? Thank you.
  8. Hi, Yes in file hw_ints.h : #define INT_TIMER0A_TM4C123 35 // 16/32-Bit Timer 0A So i made this modification : IntEnable(INT_TIMER0A_TM4C123); - and regardles at this i am not receive any kind of error. But in this moment i receive many errors and i think is not because of that modification, but in the same time i have included all header files where are defined predefined functions. #10010 errors encountered during linking; "LM4F - LaunchPad - 04.out" not built LM4F - LaunchPad - 04 C/C++ Problem unresolved symbols remain LM4F - LaunchPad - 04 C/C++ Problem unresolved symbol GPIOPinRead, first referenced in ./main.obj LM4F - LaunchPad - 04 C/C++ Problem unresolved symbol GPIOPinTypeGPIOOutput, first referenced in ./main.obj LM4F - LaunchPad - 04 C/C++ Problem unresolved symbol GPIOPinWrite, first referenced in ./main.obj LM4F - LaunchPad - 04 C/C++ Problem unresolved symbol IntEnable, first referenced in ./main.obj LM4F - LaunchPad - 04 C/C++ Problem unresolved symbol IntMasterEnable, first referenced in ./main.obj LM4F - LaunchPad - 04 C/C++ Problem unresolved symbol SysCtlClockGet, first referenced in ./main.obj LM4F - LaunchPad - 04 C/C++ Problem unresolved symbol SysCtlClockSet, first referenced in ./main.obj LM4F - LaunchPad - 04 C/C++ Problem unresolved symbol SysCtlPeripheralEnable, first referenced in ./main.obj LM4F - LaunchPad - 04 C/C++ Problem unresolved symbol TimerConfigure, first referenced in ./main.obj LM4F - LaunchPad - 04 C/C++ Problem unresolved symbol TimerEnable, first referenced in ./main.obj LM4F - LaunchPad - 04 C/C++ Problem unresolved symbol TimerIntClear, first referenced in ./main.obj LM4F - LaunchPad - 04 C/C++ Problem unresolved symbol TimerIntEnable, first referenced in ./main.obj LM4F - LaunchPad - 04 C/C++ Problem unresolved symbol TimerLoadSet, first referenced in ./main.obj LM4F - LaunchPad - 04 C/C++ Problem
  9. The issue is that the blue led is not blinking. i dont understand why ? It is possible to be a problem with interrupts ?
  10. Hi. I try to test a program from "Getting Started with the Stellaris EK-LM4F120XL LaunchPad Workshop", lab 4 "Interrupts and the Timer" (see : ).I dont understand what is the mistake. Look at this code : #include<stdio.h> #include<stdbool.h> #include<stdint.h> #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" int main() { unsigned long ulPeriod; 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_PERIODIC); ulPeriod = (SysCtlClockGet() / 10) / 2; TimerLoadSet(TIMER0_BASE, TIMER_A, ulPeriod - 1); IntEnable(TIMER_A); TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT); IntMasterEnable(); TimerEnable(TIMER0_BASE, TIMER_A); while(1) { } } void Timer0IntHandler() { TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT); // Clear the timer interrupt if(GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_2)) // Read the current state of the GPIO pin and write back the opposite state { GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, 0); } else { GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 4); } } And this is the startup_ccs file. //***************************************************************************** // // Startup code for use with TI's Code Composer Studio. // // Copyright (c) 2011-2013 Texas Instruments Incorporated. All rights reserved. // Software License Agreement // // 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. // //***************************************************************************** #include <stdint.h> //***************************************************************************** // // Forward declaration of the default fault handlers. // //***************************************************************************** void ResetISR(void); static void NmiSR(void); static void FaultISR(void); static void IntDefaultHandler(void); //***************************************************************************** // // External declaration for the reset handler that is to be called when the // processor is started // //***************************************************************************** extern void _c_int00(void); extern void Timer0IntHandler(void); //***************************************************************************** // // Linker variable that marks the top of the stack. // //***************************************************************************** extern uint32_t __STACK_TOP; //***************************************************************************** // // External declarations for the interrupt handlers used by the application. // //***************************************************************************** // To be added by user //***************************************************************************** // // The vector table. Note that the proper constructs must be placed on this to // ensure that it ends up at physical address 0x0000.0000 or at the start of // the program if located at a start address other than 0. // //***************************************************************************** #pragma DATA_SECTION(g_pfnVectors, ".intvecs") void (* const g_pfnVectors[])(void) = { (void (*)(void))((uint32_t)&__STACK_TOP), // The initial stack pointer 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 IntDefaultHandler, // GPIO Port A IntDefaultHandler, // GPIO Port B IntDefaultHandler, // GPIO Port C IntDefaultHandler, // GPIO Port D IntDefaultHandler, // GPIO Port E IntDefaultHandler, // UART0 Rx and Tx IntDefaultHandler, // UART1 Rx and Tx IntDefaultHandler, // SSI0 Rx and Tx IntDefaultHandler, // 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 IntDefaultHandler, // 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 IntDefaultHandler, // GPIO Port F IntDefaultHandler, // GPIO Port G IntDefaultHandler, // GPIO Port H IntDefaultHandler, // UART2 Rx and Tx IntDefaultHandler, // SSI1 Rx and Tx IntDefaultHandler, // Timer 3 subtimer A IntDefaultHandler, // Timer 3 subtimer B IntDefaultHandler, // I2C1 Master and Slave IntDefaultHandler, // Quadrature Encoder 1 IntDefaultHandler, // CAN0 IntDefaultHandler, // CAN1 IntDefaultHandler, // CAN2 0, // Reserved 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 0, // Reserved 0, // Reserved IntDefaultHandler, // GPIO Port J IntDefaultHandler, // GPIO Port K IntDefaultHandler, // GPIO Port L IntDefaultHandler, // SSI2 Rx and Tx IntDefaultHandler, // SSI3 Rx and Tx IntDefaultHandler, // UART3 Rx and Tx IntDefaultHandler, // UART4 Rx and Tx IntDefaultHandler, // UART5 Rx and Tx IntDefaultHandler, // UART6 Rx and Tx IntDefaultHandler, // UART7 Rx and Tx 0, // Reserved 0, // Reserved 0, // Reserved 0, // Reserved IntDefaultHandler, // I2C2 Master and Slave IntDefaultHandler, // I2C3 Master and Slave IntDefaultHandler, // 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 }; //***************************************************************************** // // 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) { // // Jump to the CCS C initialization routine. This will enable the // floating-point unit as well, so that does not need to be done here. // __asm(" .global _c_int00\n" " b.w _c_int00"); } //***************************************************************************** // // 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) { } } //***************************************************************************** // // 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) { } } //***************************************************************************** // // 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) { } }
  11. Hi. I have the next code : #include<stdint.h> #include<stdbool.h> #include"inc/hw_types.h" #include"inc/hw_memmap.h" #include"driverlib/sysctl.h" #include"driverlib/gpio.h" int main() { int LED = 4; SysCtlClockSet(SYSCTL_SYSDIV_10 | 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); while(1) { GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3, LED); SysCtlDelay(2000000); { LED ^= 4; } } } In this code i have the next instruction : SysCtlClockSet(SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN) I use PLL, so the frequency is 400MHz / 2 = 200MHz. This frequency is divided with 10, so frequency now is 20MHz. I want to generate a delay of 1 sec. The period is T = 1 / F = 1 / 20MHz T = 50 ns. In this instruction SysCtlDelay(2000000); So the delay is 50 ns * 20.000.000 = 1.000.000.000 ns = 1000 ms = 1 sec. But the delay is more than a 1 sec, something about 3 sec. Help me to compute clock frequency.
  12. Hi, guys. I am a beginner in Stellaris microcontroller programming. I try to generate a delay of 1 sec (1 sec - led ON, 1 sec - led OFF). I have selected the timer0A - 16 bits. Delay - 1sec. Frequency = 4 MHz T = 1 / 4Mhz = 250 nsec. So, to generate a delay of 1 sec : 1.000.000.000 nsec / 250 nsec = 4.000.000 4.000.000 = 62.500 * 64; But i think in my code i must set another bit, i dont know if it is correct, his name "main interrupt". Here is my code :
×
×
  • Create New...