Hi,
I am just trying to generate a simple sine wave using Tiva C series and Keil IDE, but failed. Actually I had got the code from the LAB9 of TM4C123G Launchpad Workshop. I had done slight modifications in the code in-order to add the variable to logic analyzer of Keil IDE. During the simulation, I can find that the simulation is stopping at
SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN);
and showing the *** error 65: access violation at 0x400FE058 : no 'write' permission and cannot able to proceed the simulation as it is showing the no read and no write errors. Then I had changed the above line to
SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
and this time also shows the same error that I had mentioned above and stops . But when I had pressed the run option again this executes normally. Need a solution for this and here is the code
#include <stdint.h> #include <stdbool.h> #include <math.h> #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "driverlib/fpu.h" #include "driverlib/sysctl.h" #ifndef M_PI #define M_PI 3.14159265358979323846 #endif #define SERIES_LENGTH 100 float gSeriesData[SERIES_LENGTH]; int32_t i32DataCount = 0; float fRadians; unsigned char i; int main(void) { FPULazyStackingEnable(); FPUEnable(); SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN); //SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); fRadians = ((2 * M_PI) / SERIES_LENGTH); while(i32DataCount < SERIES_LENGTH) { gSeriesData[i32DataCount] = sinf(fRadians * i32DataCount); i32DataCount++; } while(1) { } }