Jump to content

superbrew

Members
  • Content count

    37
  • Joined

  • Last visited

  1. CC3100 - No DNS specified

    Thanks, I'll try over there
  2. CC3100 - No DNS specified

    Anyone? Is there a better forum for these types of questions?
  3. CC3100 - No DNS specified

    I just received my CC3100 booster and I am having some trouble with it. I am not familiar with the networking stuff, so I am not sure where the problem lies. I have been able to get the web server example working, where I can turn the LP LED on and off through the browser. I am also able to get the NTP time example working. When I try to run the weather example, I get an error value of -161 (No DNS specified) when I get to the GetHostIP function. What is causing this? The code I am using is the getweather from the CC3100 examples. I have not modified anything except my network settings in SL_common.h Thanks
  4. Hi, I am able to get the testDHCP example working, but on others I get the following error: In function `abort': abort.c:(.text.abort+0xa): undefined reference to `_exit' collect2.exe: error: ld returned 1 exit status How do I fix that? I have tried different versions of Energia, I have replaced the 'cores' lm4f library, I have replaced spi.cpp and spi.h. EDIT: I figured it out, there is a commented section in startup_gcc.c __attribute__((weak)) extern void _exit (void) { } I uncommented and it is working fine now.
  5. Timer prescale

    Hello, I am trying to read a pulse that is 1-2ms wide and has a PRI of 20ms. This code is producing a value of ~30000 (1.5mS). No matter what I change the prescale value to, the count is always the same. My understanding from the data sheet is that the prescaler only works when the timer is in half width mode, which I assume it is due to configuring it as a split pair. Is this assumption correct? #include <stdint.h> #include <stdio.h> #include <stdbool.h> #include <math.h> #include <string.h> #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "inc/hw_ints.h" #include "inc/hw_gpio.h" #include "driverlib/debug.h" #include "driverlib/fpu.h" #include "driverlib/gpio.h" #include "driverlib/pin_map.h" #include "driverlib/rom.h" #include "driverlib/ssi.h" #include "driverlib/sysctl.h" #include "driverlib/systick.h" #include "driverlib/timer.h" #include "driverlib/uart.h" #include "driverlib/interrupt.h" #include "utils/uartstdio.h" volatile uint16_t t1A = 0, t2A = 0, timeA = 0, offTimeA = 0; volatile uint16_t t1B = 0, t2B = 0, timeB = 0, offTimeB = 0; //***************************************************************************** // // Timer2 interrupt // //***************************************************************************** void IntWTimer2AHandler(void) { if(TimerIntStatus(WTIMER2_BASE, TIMER_CAPA_EVENT)) { TimerIntClear(WTIMER2_BASE, TIMER_CAPA_EVENT); t2A = TimerValueGet(WTIMER2_BASE, TIMER_A); if(t2A > t1A) timeA = t2A - t1A; else timeA = (UINT32_MAX - t1A) + t2A; t1A = t2A; } } //***************************************************************************** // // Configure the UART and its pins. This must be called before UARTprintf(). // //***************************************************************************** void ConfigureUART(void) { // // Enable the GPIO Peripheral used by the UART. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); // // Enable UART0 // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); // // Configure GPIO Pins for UART mode. // ROM_GPIOPinConfigure(GPIO_PA0_U0RX); ROM_GPIOPinConfigure(GPIO_PA1_U0TX); ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); // // Use the internal 16MHz oscillator as the UART clock source. // UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC); // // Initialize the UART for console I/O. // UARTStdioConfig(0, 115200, 16000000); } //***************************************************************************** // // This is the main loop that runs the application. // //***************************************************************************** int main(void) { // // Turn on stacking of FPU registers if FPU is used in the ISR. // FPULazyStackingEnable(); // // Set the clocking to run from the PLL at 10MHz. // ROM_SysCtlClockSet(SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ); ROM_IntMasterDisable(); // // Enable the Debug UART // ConfigureUART(); // // Enable Peripheral Clocks // SysCtlPeripheralEnable(SYSCTL_PERIPH_WTIMER2); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); // // Enable pin PD1 for WTIMER2 WT2CCP1 // GPIOPinConfigure(GPIO_PD1_WT2CCP1); GPIOPinTypeTimer(GPIO_PORTD_BASE, GPIO_PIN_1); // // Enable pin PD0 for WTIMER2 WT2CCP0 // TimerConfigure(WTIMER2_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_CAP_TIME_UP /*| TIMER_CFG_B_CAP_TIME_UP*/); TimerPrescaleSet(WTIMER2_BASE, TIMER_BOTH, 2); TimerControlEvent(WTIMER2_BASE, TIMER_A, TIMER_EVENT_BOTH_EDGES); //TimerControlEvent(WTIMER2_BASE, TIMER_B, TIMER_EVENT_BOTH_EDGES); SysCtlDelay(10); TimerEnable(WTIMER2_BASE, TIMER_A); ROM_IntEnable(INT_WTIMER2A); TimerIntClear(WTIMER2_BASE, TIMER_CAPA_EVENT); // // Enable interrupts to the processor. // TimerIntEnable(WTIMER2_BASE, TIMER_CAPA_EVENT); //TimerIntEnable(WTIMER2_BASE, TIMER_CAPB_EVENT); ROM_IntPrioritySet(INT_TIMER2A, 0x00); UARTprintf("ready clock: %d\n", SysCtlClockGet()); ROM_IntMasterEnable(); TimerIntClear(WTIMER2_BASE, TIMER_CAPA_EVENT); SysCtlDelay(SysCtlClockGet()); while(1) { UARTprintf("timeA:%i\ttimerB:%i\n", timeA, TimerPrescaleGet(WTIMER2_BASE, TIMER_A)); SysCtlDelay(SysCtlClockGet()/20); } }
  6. LCD Demo

    I have been working on some stuff with RobG's LCD backpack. Here is a short demo of my progress making a particle system and displaying a pciture. I know they are unrelated, but there is so much to do!
  7. Help with array of structs

    So, there is a problem with my code above. After some time, the number of particles visible on the screen reduced to zero. I didn't notice at first because I had 100 particles. I am still learning C, so ti was not obvious to me what was going on at first. Here is some code that works, for real this time Now, I need to figure out how to make the animation smoother. I am clearing the screen between each update, which causes it to flicker. void EvolveParticle() { int i = 0; for(i=0;i < MAXPARTICLE; i++) { // evolve the particle parameters particle[i].lifetime -= particle[i].decay; if(particle[i].lifetime <= 0)particle[i].active = false; if(particle[i].xPos >= 0 || particle[i].xPos <= getScreenWidth()) (&particle[i])->xPos += particle[i].xSpeed; if(particle[i].yPos >= 0 || particle[i].yPos <= getScreenHeight()) (&particle[i])->yPos += particle[i].ySpeed; (&particle[i])->ySpeed -= 1; setColor(particle[i].color); if(particle[i].active == false) { (&particle[i])->lifetime = rand()%20; (&particle[i])->decay = 1; (&particle[i])->color = (rand()%0x1f << 11) + (rand()%0x3f << 5) + rand()%0x1f; (&particle[i])->xPos= 0; (&particle[i])->yPos= 0; (&particle[i])->xSpeed = 5 + rand()%3; (&particle[i])->ySpeed = 13 + rand()%8; (&particle[i])->active = true; } else { drawPixel(particle[i].xPos+1, particle[i].yPos); drawPixel(particle[i].xPos+1, particle[i].yPos+1); drawPixel(particle[i].xPos, particle[i].yPos); drawPixel(particle[i].xPos, particle[i].yPos+1); } } }
  8. Help with array of structs

    Hi pabigot, thanks for your help. I changed the loop bound as you suggested and it had no effect on the code. Then I just replaced the function call with the code that was inside of the function call and it worked. I am not sure why that works, but it does. With that code above, I have a continuous stream of particles flowing from the bottom of my LCD.
  9. Help with array of structs

    Ok, so this does what I want, but I don't know why. I also made the particles a little bigger. void EvolveParticle() { int i = 0; for(i=0;i < MAXPARTICLE; i++) { // evolve the particle parameters particle[i].lifetime -= particle[i].decay; if(particle[i].lifetime == 0)particle[i].active = false; if(particle[i].xPos >= 0 || particle[i].xPos <= getScreenWidth()) particle[i].xPos += particle[i].xSpeed; if(particle[i].yPos >= 0 || particle[i].yPos <= getScreenHeight()) particle[i].yPos += particle[i].ySpeed; particle[i].ySpeed -= 1; setColor(particle[i].color); if(particle[i].active) { drawPixel(particle[i].xPos, particle[i].yPos); drawPixel(particle[i].xPos+1, particle[i].yPos); drawPixel(particle[i].xPos, particle[i].yPos+1); drawPixel(particle[i].xPos+1, particle[i].yPos+1); } else { particle[i].lifetime= 10 + rand()%30; particle[i].decay=1; particle[i].color = rand(); particle[i].xPos= getScreenWidth()/2; particle[i].yPos= 0; particle[i].zPos= 0; particle[i].xSpeed = 5 - rand()%10; particle[i].ySpeed = 1 + rand()%15; particle[i].active = true; } } }
  10. Help with array of structs

    Hello, I am trying to get a simple particle system working on an LCD screen. I am running into trouble when trying to modify my array particle structs. If I rewrite the whole array, it works, but if I try to modify one element of the array, I fall into the fault ISR. Here is the nonworking code: #include <stdbool.h> #include <stdlib.h> #include "particle.h" #include "graphics.h" #include "lcd.h" int MAXPARTICLE = 20; PARTICLE particle[MAXPARTICLE]; void CreateParticle(int i) { particle[i].lifetime= 1 + rand()%20; particle[i].decay=1; particle[i].color = 0xffffff; particle[i].xPos= getScreenWidth()/2; particle[i].yPos= 0; particle[i].zPos= 0; particle[i].xSpeed = 1 + rand()%10; particle[i].ySpeed = 1 + rand()%10; particle[i].active = true; } void EvolveParticle() { int i = 0; for(i=0;i<=MAXPARTICLE;i++) { // evolve the particle parameters particle[i].lifetime -= particle[i].decay; if(particle[i].lifetime == 0)particle[i].active = false; particle[i].xPos += particle[i].xSpeed; particle[i].yPos += particle[i].ySpeed; particle[i].ySpeed -= 1; setColor(particle[i].color); if(particle[i].active) { drawPixel(particle[i].xPos, particle[i].yPos); } else { CreateParticle(i); } } } My main code just consists of calling CreateParticle 20 times, then a loop of EvolveParticle, short delay, clear the screen, repeat. It works fine until I add the CreateParticle call in EvolveParticle. I would to have a continuous fountain of particles flowing from the bottom of my screen. Thanks
  11. RGB Matrix slot machine game

    I have made some updates to this project. I have limited the colors to 3, so that I can 'win' once in a while. Once I figure out to calculate odds and probabilities a little better, I will add some more colors. I also used one of the on board switches to initiate a spin.
  12. MPU6050

    Not sure if this would help, but I use this firmware on my quadcopter, and I would say the yaw is stable on that. The board I am using in my quad uses an MPU6050 for the accel/gyro. Maybe digging through this will give you some ideas https://github.com/MegaPirateNG
  13. RGB Matrix slot machine game

    Thanks, I saw your Matrix BP, but it is PCB only. I am not good enough yet to solder SMT components. I am waiting for you LCD touchscreen backpack.
  14. MPU6050

    Here is the function I use to collect the data: uint32_t newTicks; float MotionMain(uint32_t ticks) { float gX, gY, gZ, aX, aY, aZ; float gyro_angle_x; static float oldAngle; volatile float dt; float alpha = 0.90; MPU6050DataRead(&g_sMPU6050Inst, MotionCallback, &g_sMPU6050Inst); MotionI2CWait(__FILE__, __LINE__); MPU6050DataGyroGetFloat(&g_sMPU6050Inst, &gX, &gY, &gZ); MPU6050DataAccelGetFloat(&g_sMPU6050Inst, &aX, &aY, &aZ); aX = ((atanf(aY/sqrtf(pow(aX,2)+pow(aZ,2))))*57.296) - g_faoffsetX; dt = (float)ticks/1000; gyro_angle_x = oldAngle + ((gX-g_fgoffsetX)*dt)*57.296; oldAngle = alpha*gyro_angle_x + (1-alpha)*aX; return oldAngle; } This is only for one axis, in this case X. Here is the PID routine, I think there is much room for improvement here: float PID(float setpoint, float input, float Kp, float Ki, float Kd) { static float oldError; float error = setpoint - input; static float I_err; static float D_err; if(input > -0.5 && input < 0.5) error = 0; I_err += oldError; D_err = error - oldError; oldError = error; return Kp*error + Ki*I_err + Kd*D_err; } And the main loop, this is messy and needs a lot of work: ticks = 0; oldticks = 0; // // Drop into the main loop. // oldticks = g_ui32SysTickCount; while(1) { angle = MotionMain(ticks); if(UARTPeek('\r') != -1) { UARTgets(command, sizeof(command)); sscanf(command, "%f,%f,%f", &Kp, &Ki, &Kd); } PIDangle = PID(0.0,angle, Kp, Ki, Kd); ui8Adjust = round((-PIDangle)); if(firstTime != 0) ROM_PWMPulseWidthSet(PWM0_BASE, PWM_OUT_4, ui8Adjust * ui32Load / 1000); firstTime = 1; SysCtlDelay(SysCtlClockGet()/300); ticks = g_ui32SysTickCount - oldticks; oldticks = g_ui32SysTickCount; } This code gets 'lost' easily. If I exceed the travel of the servo or move too quickly it can get stuck at one extreme or the other. I think this project is beyond my level for the time being, so I have put it on hold to work my way up.
  15. RGB Matrix slot machine game

    I have started to develop a slot machine based an 8x8 RGB matrix. I intend this to be a learning experience, and I am going to focus on the logic and control of the game. Hardware: Tiva C Launchpad TLC5947 breakout from Adafruit 8 PNP transistors 8 1k resistors As of right now, I have 2x2 sprites in 6 colors representing the symbols on the reels. Each 'spin', I populate an array representing the matrix with randomly chosen colors of sprites and place them in the matrix. Then I set a random number of rotations where the symbols spin and then slow down and come a stop. As of right now, all three reels spin and stop at the same rate, but I plan to update that to be more slot machine like. I also have not implemented any sort of win detection mechanism. Here is a short video, but it looks much better in person. The scrolling effect is much smoother and realistic.
×