Jump to content
Forum sending old emails Read more... ×

tonrei

Members
  • Content Count

    6
  • Joined

  • Last visited

  1. tonrei

    Tiva- Connected Launchpad DSO

    Hi Icdiman, I used windows 7 and stopt this project, at least for now. Since u say that their project runs ok, did you change the anwer on the "i" command? If so, maybe change in their program the subprograms step by step. (or even line by line, I used Notepad++ for that).
  2. tonrei

    Tiva- Connected Launchpad DSO

    Hi icdiman, You best check the manual (pdf ) from www.syscompdesign.com.
  3. tonrei

    Tiva- Connected Launchpad DSO

    Tiva- Connected Launchpad DSO Here is a beginners version of an Oscilloscope and Network Analyser, using the Connected Launchpad as digitiser and a modified version of the CircuitGear Mini Graphic User Interface of Syscomp Electronic Design Ltd. www.syscompdesign.com. Spec’s: 1 channel differential @ 4 Msps or 2 channel diff. @ 2 Msps max. The 12 bit ADCs sample always at 2Msps, on lower required speeds the signals are oversampled as much as practical for an output of 14 bit unsigned integers. This makes aliasing-filtering easier. The timing is entirely done by the ADC-clock. The software is made with "Energia version 0101E0012" ; thanks for this "easy to start with" tool. and with the wiring_analog.c from https://github.com/vladn2/Energia/ . (this one does not use interrupts). There are many comments in the code to explain the workings. There are timing problems while using Energia version 0101E0013 even with the new pde.jar for optimisation. With a AD9850 direct digital synthesis (DDS) as sine-wave generator, output frequency resolution of 0.0291 Hz with a 125 MHz reference clock. This is based on: http://forum.stellarisiti.com/topic/558-ad9850-with-energia/ CircuitGear GUI modification. The offset (new in vertical.tcl) and Gnd-shift (in cursors.tcl) is now handled in the GUI (display.tcl), not in hardware. In display.tcl is channel C embedded as product of chan.A and B for power measurement. Change of the vertical settings or the cursors ends in a re-plot of the screen with the old data for further investigation. For the trigger-modes and options are buttons used, very handy especially for Single-shot to quickly stop acquisition when a freak signal occurs (the menus are still there). The Single-shot mode now also functions in the scan-mode, so that acquisition stops at the end of the screen. While developing, it became necessary to add a ‘disconnect, item to the hardware menu. The Waveform Generator GUI sends its frequency value as one big number to the LaunchPad. Amplitude and offset are not used (yet). In the Network Analyser mode the logarithmic frequency settings and the right plot limit are changed and the ‘End Frequency’ is as measurement step added. The logarithmic steps are now set by the number of steps per decade. To implement these changes, install the GUI from www.syscompdesign.com. Than rename the original tcl-files in the source-directory that must be replaced by the modified ones and copy the modified versions in the source-directory. Also copy the two images (these were necessary to better fit my screen) in the Images-directory. Future plans: Build the analog part. Implement amplitude setting on the DDS. Implement a Hi-Res-mode by using a longer circular buffer. Tiva-DSO and GUI modification.zip CircuitGear display.zip
  4. tonrei

    Stellaris fast analog reads

    This last entry of me (tonrei) is not working the way I discribed. The ping-pong trick does not work, all the samples come from the same sample-sequencer. That is because the Trigger "ALWAYS" instruction for the hiest priority sequencer blocks the other sample-sequencers. I'm now using the connected launchpad for a further development of the DSO. If I caused someone a headache ........... apollagies
  5. tonrei

    Stellaris fast analog reads

    Hi, I worked on with the DSO of Patolin Posted 30 July 2013. Here is my code. // stelarisDSO v1.2 // 2014-04-24 // 1 channel differencial @ 2 Msps or 2 channel diff. @ 1 Msps max. #include "Energia.h" #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "inc/hw_ints.h" #include "inc/lm4f120h5qr.h" // for register access ii faster ADCinterupt handling #include "driverlib/debug.h" #include "driverlib/interrupt.h" #include "driverlib/sysctl.h" #include "driverlib/adc.h" #include "driverlib/timer.h" #define buffersize 2048 unsigned long size = 2047; // 63, 127, 255, 511, 1023 or 2047. * use only 2^n -1 unsigned long aux0; unsigned long aux1; unsigned long aux2; unsigned long adc0[buffersize ] = { 0} ; // unsigned int wil do, but u-long takes up the same RAMspace unsigned long adc1[buffersize ] = { 0}; // and saves time in the int-serviceroutine (no convertion required) byte oversample = 1; /* hardware average factor, 0, 1, 2, 4, 8, 16, 32 or 64 0 = (sum of) ADC0 and ADC1 for single channel 2MSPS, */ byte oversample5 = 0; /* 0= soft-average ADC0 and ADC1 for single channel 2MSPS, 1= no soft-average 5 = 5 sampels soft-average in 1 interupt, 25 = 25 sampels soft-average */ byte pass = 1; byte mult = 5; // results are 5 * ADC-values = 0 - 20480 (12 to 14¼ bits ). unsigned long adc0sum; // for soft-average unsigned long adc1sum; unsigned int dataReady=0; unsigned int pointer=0; void setup() { int count; Serial.begin(115200); pinMode(RED_LED, OUTPUT); pinMode(BLUE_LED, OUTPUT); pinMode(GREEN_LED, OUTPUT); for (count=0;count<4;count++) { digitalWrite(GREEN_LED,1); delay(100); digitalWrite(RED_LED,1); delay(100); digitalWrite(BLUE_LED,1); delay(100); digitalWrite(GREEN_LED,0); delay(100); digitalWrite(RED_LED,0); delay(100); digitalWrite(BLUE_LED,0); delay(100); } Serial.println("Stellaris 2 channel DSO"); Serial.println("Based on work from 2013 www.patolin.com"); Serial.println("and http://forum.stellarisiti.com/topic/684 "); Serial.print(SysCtlClockGet()); Serial.println(" hz systemclock "); Serial.println(" "); Serial.println(" c to start ? for keys "); initADC(); // tone(GREEN_LED,10000); testsignal, not tested yet } void loop() { int count; String text(" ? "); unsigned char serialin; while (1) { if (Serial.available()>0) { serialin=Serial.read(); switch (serialin) { case 'a': size = 63; break; case 's': size = 126; break; case 'd': size = 255; break; case 'f': size = 511; break; case 'g': size = 1023; break; case 'h': size = 2047; break; case 'c': // convert and output the results while (!dataReady) { // wait for full databuffer } // disable interupts == stop aquisition ADCIntDisable(ADC0_BASE, 0); ADCIntDisable(ADC0_BASE, 3); delay(2); // be shure last interupt is done //Serial.println(size + 1); number of datapoints // Data is output in a format for "SerialChart" (www.Starlino.com) for (count=0 ; count < size+1 ; count++) { //Serial.print(pointer); // start print where ADC stopped Serial.print(","); if (!oversample) { // single channel aux0 = (adc0[pointer]); aux1 = (adc1[pointer]); aux2 = (adc0[(++pointer &= size) ]); Serial.println((aux0 + aux1) * mult / 2 ); Serial.print(","); Serial.println((aux0 + aux2) * mult / 2 ); } else { // 2 channels Serial.print((adc0[pointer]) * mult); // start print where ADC stopped Serial.print(","); Serial.println((adc1[pointer]) * mult); ++pointer &= size; } } break; case 'q': text = String(" 500 sps 2 channels "); oversample=16; oversample5=25; mult = 1; break; case '1': text = String(" 1 ksps 2 channels "); oversample=8; oversample5=25; // 8 * 5 * 5 * 5 = / 1000 mult = 1; break; case '2': text = String(" 2 ksps 2 channels "); oversample=4; oversample5=25; // 4 * 5 * 5 * 5 = / 500 mult = 1; break; case '3': text = String(" 5 ksps 2 channels "); oversample=8; oversample5=5; mult = 1; break; case '4': text = String(" 10 ksps 2 channels "); oversample=4; oversample5=5; // 4 * 5 * 5 = / 100 mult = 1; break; case '5': text = String(" 25 ksps 2 channels "); oversample=8; oversample5=1; mult = 1; break; case '6': text = String(" 50 ksps 2 channels "); oversample=4; oversample5=1; mult = 1; break; case '7': text = String(" 100 ksps 2 channels "); oversample=2; oversample5=1; // 2 * 5 = / 10 mult = 1; break; case '8': text = String(" 250 ksps 2 channels "); oversample=4; oversample5=0; mult = 5; break; case '9': text = String(" 500 ksps 2 channels "); oversample=2; oversample5=0; mult = 5; break; case '0': text = String(" 1 Msps 2 channels "); oversample=1; oversample5=0; mult = 5; break; case '-': text = String(" 2 Msps single channel "); oversample=0; oversample5=0; mult = 5; break; default: text = String("???? "); Serial.println(" . "); Serial.println("For samplerate hit :"); Serial.println(" q, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 or - "); Serial.println("500, 1k, 2k, 5k, 10k, 25k, 50k, 100k, 200k, 500k, 1M or 2M "); Serial.println(" "); Serial.println("For bufferssize : hit"); Serial.println(" a, s, d, f, g or h "); Serial.println(" 64, 128, 256, 512, 1024, 2048 bufferssize"); Serial.println(" . "); Serial.println(" c to start "); } Serial.print(text); Serial.print(" oversample: "); Serial.print(oversample); Serial.print(" oversample5: "); Serial.print(oversample5); Serial.print(" buffersize: "); Serial.println(size + 1 ); initADC(); // restart conversions digitalWrite(RED_LED, 0x00); digitalWrite(BLUE_LED, 0x01); } } } // end of loop void ADC0IntHandler_0Fast() { ADCIntClear(ADC0_BASE,0); // sequencer 0 adc0[pointer] = ADC0_SSFIFO0_R ; //step0 adc1[pointer] = ADC1_SSFIFO0_R; if (!(++pointer &= size)) dataReady=1; adc0[pointer] = ADC0_SSFIFO0_R ; //step1 adc1[pointer] = ADC1_SSFIFO0_R; if (!(++pointer &= size)) dataReady=1; adc0[pointer] = ADC0_SSFIFO0_R ; //step2 adc1[pointer] = ADC1_SSFIFO0_R; if (!(++pointer &= size)) dataReady=1; adc0[pointer] = ADC0_SSFIFO0_R ; //step3 adc1[pointer] = ADC1_SSFIFO0_R; if (!(++pointer &= size)) dataReady=1; adc0[pointer] = ADC0_SSFIFO0_R ; //step4 adc1[pointer] = ADC1_SSFIFO0_R; if (!(++pointer &= size)) dataReady=1; } void ADC0IntHandler_3Fast() { ADCIntClear(ADC0_BASE,3); // sequencer 1 and 3 adc0[pointer] = ADC0_SSFIFO1_R ; //step0 adc1[pointer] = ADC1_SSFIFO1_R; if (!(++pointer &= size)) dataReady=1; adc0[pointer] = ADC0_SSFIFO1_R ; //step1 adc1[pointer] = ADC1_SSFIFO1_R; if (!(++pointer &= size)) dataReady=1; adc0[pointer] = ADC0_SSFIFO1_R ; //step2 adc1[pointer] = ADC1_SSFIFO1_R; if (!(++pointer &= size)) dataReady=1; adc0[pointer] = ADC0_SSFIFO1_R ; //step3 adc1[pointer] = ADC1_SSFIFO1_R; if (!(++pointer &= size)) dataReady=1; adc0[pointer] = ADC0_SSFIFO3_R ; //step0 adc1[pointer] = ADC1_SSFIFO3_R; if (!(++pointer &= size)) dataReady=1; } void ADC0IntHandler_0Av() { ADCIntClear(ADC0_BASE,0); adc0sum += (ADC0_SSFIFO0_R + ADC0_SSFIFO0_R + ADC0_SSFIFO0_R + ADC0_SSFIFO0_R + ADC0_SSFIFO0_R) ; //sum step 0,1,2,3,4 sequ 0 adc1sum += (ADC1_SSFIFO0_R + ADC1_SSFIFO0_R + ADC1_SSFIFO0_R + ADC1_SSFIFO0_R + ADC1_SSFIFO0_R) ; if (!--pass ) { pass = oversample5; adc0[pointer] = adc0sum /oversample5; adc1[pointer] = adc1sum /oversample5; adc0sum = 0; adc1sum = 0; ++pointer &= size; } if (!pointer) dataReady=1; } void ADC0IntHandler_3Av() { ADCIntClear(ADC0_BASE,3); adc0sum += (ADC0_SSFIFO1_R + ADC0_SSFIFO1_R + ADC0_SSFIFO1_R + ADC0_SSFIFO1_R + ADC0_SSFIFO3_R) ; //sum step 0, 1, 2,3 sequ.1 + adc1sum += (ADC1_SSFIFO1_R + ADC1_SSFIFO1_R + ADC1_SSFIFO1_R + ADC1_SSFIFO1_R + ADC1_SSFIFO3_R) ; // step 0 sequ.3 if (!--pass ) { pass = oversample5; adc0[pointer] = adc0sum / oversample5 ; adc1[pointer] = adc1sum /oversample5 ; adc0sum = 0; adc1sum = 0; ++pointer &= size; } if (!pointer) dataReady=1; } void initADC() { SysCtlADCSpeedSet(SYSCTL_ADCSPEED_1MSPS); SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); // first ADCspeed then Enable SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC1); ADCSequenceDisable(ADC0_BASE, 0); // use sequencer 0 (5 of 8 steps) first ADCSequenceDisable(ADC1_BASE, 0); // and sequencer 1+3 (4+1=5 steps) in ping-pong* ADCSequenceDisable(ADC0_BASE, 1); ADCSequenceDisable(ADC1_BASE, 1); ADCSequenceDisable(ADC0_BASE, 3); ADCSequenceDisable(ADC1_BASE, 3); /* ping-pong in this case is: ping: first take autonome 5 samples, raise interupt and end sequence 0. Interup-routine handles these 5 samples WHILE pong: sequencer 1 takes the next 4 samples and sequencer 3 the 5st sequencer 3 raise interupt and end sequence. Interup-routine handles these 5 samples WHILE ping; sequencer 3's "end sequence" starts the ping (sequence 0) again. */ ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_ALWAYS, 0); // priority 0 ADCSequenceConfigure(ADC1_BASE, 0, ADC_TRIGGER_ALWAYS, 0); ADCSequenceConfigure(ADC0_BASE, 1, ADC_TRIGGER_ALWAYS, 1); // priority 1 ADCSequenceConfigure(ADC1_BASE, 1, ADC_TRIGGER_ALWAYS, 1); ADCSequenceConfigure(ADC0_BASE, 3, ADC_TRIGGER_ALWAYS, 2); // priority 2 ADCSequenceConfigure(ADC1_BASE, 3, ADC_TRIGGER_ALWAYS, 2); if (!oversample ) { // 2Msps on chan.0 ADCPhaseDelaySet(ADC0_BASE, ADC_PHASE_270); ADCPhaseDelaySet(ADC1_BASE, ADC_PHASE_90); //ping ADCSequenceStepConfigure(ADC0_BASE, 0, 0, ADC_CTL_CH0 |ADC_CTL_D ); // sequencer 0, step 0, chan 0, Differential ADCSequenceStepConfigure(ADC1_BASE, 0, 0, ADC_CTL_CH0 |ADC_CTL_D ); // ADC1 same as ADC0 ADCSequenceStepConfigure(ADC0_BASE, 0, 1, ADC_CTL_CH0 |ADC_CTL_D); // sequencer 0, step 1 ADCSequenceStepConfigure(ADC1_BASE, 0, 1, ADC_CTL_CH0 |ADC_CTL_D); ADCSequenceStepConfigure(ADC0_BASE, 0, 2, ADC_CTL_CH0 |ADC_CTL_D); // step 2 ADCSequenceStepConfigure(ADC1_BASE, 0, 2, ADC_CTL_CH0 |ADC_CTL_D); ADCSequenceStepConfigure(ADC0_BASE, 0, 3, ADC_CTL_CH0 |ADC_CTL_D); // step 3 ADCSequenceStepConfigure(ADC1_BASE, 0, 3, ADC_CTL_CH0 |ADC_CTL_D); ADCSequenceStepConfigure(ADC0_BASE, 0, 4, ADC_CTL_CH0 |ADC_CTL_D | ADC_CTL_IE | ADC_CTL_END); // step 4 ADCSequenceStepConfigure(ADC1_BASE, 0, 4, ADC_CTL_CH0 |ADC_CTL_D | ADC_CTL_END); // 1 interupt serves both ADC's //pong ADCSequenceStepConfigure(ADC0_BASE, 1, 0, ADC_CTL_CH0 |ADC_CTL_D ); // sequencer 1, step 0 ADCSequenceStepConfigure(ADC1_BASE, 1, 0, ADC_CTL_CH0 |ADC_CTL_D ); ADCSequenceStepConfigure(ADC0_BASE, 1, 1, ADC_CTL_CH0 |ADC_CTL_D); // step 1 ADCSequenceStepConfigure(ADC1_BASE, 1, 1, ADC_CTL_CH0 |ADC_CTL_D); ADCSequenceStepConfigure(ADC0_BASE, 1, 2, ADC_CTL_CH0 |ADC_CTL_D); // step 2 ADCSequenceStepConfigure(ADC1_BASE, 1, 2, ADC_CTL_CH0 |ADC_CTL_D); ADCSequenceStepConfigure(ADC0_BASE, 1, 3, ADC_CTL_CH0 |ADC_CTL_D| ADC_CTL_END); // step 3 end sequencer 1 and ADCSequenceStepConfigure(ADC1_BASE, 1, 3, ADC_CTL_CH0 |ADC_CTL_D| ADC_CTL_END); // continue with sequencer 3 ADCSequenceStepConfigure(ADC0_BASE, 3, 0, ADC_CTL_CH0 |ADC_CTL_D | ADC_CTL_IE | ADC_CTL_END ); // sequencer 3, step 0 ADCSequenceStepConfigure(ADC1_BASE, 3, 0, ADC_CTL_CH0 |ADC_CTL_D | ADC_CTL_END ); // only ADC_0 with interupt, it serves both } else{ ADCPhaseDelaySet(ADC0_BASE, ADC_PHASE_90); ADCPhaseDelaySet(ADC1_BASE, ADC_PHASE_90); //ping ADCSequenceStepConfigure(ADC0_BASE, 0, 0, ADC_CTL_CH0 |ADC_CTL_D ); // sequencer 0, step 0 ADCSequenceStepConfigure(ADC1_BASE, 0, 0, ADC_CTL_CH1 |ADC_CTL_D ); // ADC1 same as ADC0 ADCSequenceStepConfigure(ADC0_BASE, 0, 1, ADC_CTL_CH0 |ADC_CTL_D); // sequencer 0, step 1 ADCSequenceStepConfigure(ADC1_BASE, 0, 1, ADC_CTL_CH1 |ADC_CTL_D); ADCSequenceStepConfigure(ADC0_BASE, 0, 2, ADC_CTL_CH0 |ADC_CTL_D); // step 2 ADCSequenceStepConfigure(ADC1_BASE, 0, 2, ADC_CTL_CH1 |ADC_CTL_D); ADCSequenceStepConfigure(ADC0_BASE, 0, 3, ADC_CTL_CH0 |ADC_CTL_D); // step 3 ADCSequenceStepConfigure(ADC1_BASE, 0, 3, ADC_CTL_CH1 |ADC_CTL_D); ADCSequenceStepConfigure(ADC0_BASE, 0, 4, ADC_CTL_CH0 |ADC_CTL_D | ADC_CTL_IE | ADC_CTL_END); // step 4 ADCSequenceStepConfigure(ADC1_BASE, 0, 4, ADC_CTL_CH1 |ADC_CTL_D | ADC_CTL_END); // 1 interupt serves both ADC's //pong ADCSequenceStepConfigure(ADC0_BASE, 1, 0, ADC_CTL_CH0 |ADC_CTL_D ); // sequencer 1, step 0 ADCSequenceStepConfigure(ADC1_BASE, 1, 0, ADC_CTL_CH1 |ADC_CTL_D ); ADCSequenceStepConfigure(ADC0_BASE, 1, 1, ADC_CTL_CH0 |ADC_CTL_D); // step 1 ADCSequenceStepConfigure(ADC1_BASE, 1, 1, ADC_CTL_CH1 |ADC_CTL_D); ADCSequenceStepConfigure(ADC0_BASE, 1, 2, ADC_CTL_CH0 |ADC_CTL_D); // step 2 ADCSequenceStepConfigure(ADC1_BASE, 1, 2, ADC_CTL_CH1 |ADC_CTL_D); ADCSequenceStepConfigure(ADC0_BASE, 1, 3, ADC_CTL_CH0 |ADC_CTL_D| ADC_CTL_END); // step 3 ADCSequenceStepConfigure(ADC1_BASE, 1, 3, ADC_CTL_CH1 |ADC_CTL_D| ADC_CTL_END); // continue with sequencer 3 ADCSequenceStepConfigure(ADC0_BASE, 3, 0, ADC_CTL_CH0 |ADC_CTL_D | ADC_CTL_IE | ADC_CTL_END ); // sequencer 3, step 0 ADCSequenceStepConfigure(ADC1_BASE, 3, 0, ADC_CTL_CH1 |ADC_CTL_D | ADC_CTL_END ); // only ADC_0 with interupt, it serves both } ADCIntRegister(ADC0_BASE, 0, ADC0IntHandler_0Fast); // set interupt-handler adress ADCIntRegister(ADC0_BASE, 3, ADC0IntHandler_3Fast); if (oversample5) { ADCIntRegister(ADC0_BASE, 0, ADC0IntHandler_0Av ); // overwrite interupt-handler adress ADCIntRegister(ADC0_BASE, 3, ADC0IntHandler_3Av ); } ADCHardwareOversampleConfigure(ADC0_BASE, oversample); ADCHardwareOversampleConfigure(ADC1_BASE, oversample); dataReady=0; pointer=0; adc0sum = 0; adc1sum = 0; pass = oversample5; ADCSequenceEnable(ADC0_BASE, 0); ADCSequenceEnable(ADC1_BASE, 0); ADCSequenceEnable(ADC0_BASE, 1); ADCSequenceEnable(ADC1_BASE, 1); ADCSequenceEnable(ADC0_BASE, 3); ADCSequenceEnable(ADC1_BASE, 3); ADCIntEnable(ADC0_BASE, 0); ADCIntEnable(ADC0_BASE, 3); // and enable interupt }
  6. tonrei

    IDE FOR Stellaris LaunchPad (EK-LM4F120XL)

    Hi all, I used Energia some days now with a StellarisLP and came across two "problems". 1. an O and an 0 look the same on my Win7 PC. 2. Integer is described as a 2 byte value, hoewever...they take up 4 bytes in a Stellaris. See next sketch. ************************************************ /*Stellaris LaunchPad EK-LM4F120XL energia-0101E0012/reference/Int.html Integer is described as a 2 byte value, however... This little sketch shows that integers take up 4 bytes in a Stellaris LaunchPad and not 2 Bytes Uncomment one // line, hit Verify and a "will not fit in region `ram'" error appears. */ #include "Energia.h" #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "inc/hw_ints.h" //byte i[33000]; // will not fit in region `ram' //byte i[32000]; // ok fits int i[9000]; // will not fit in region `ram' //int i[8000]; // ok fits //long i[9000]; // will not fit in region `ram' //long i[8000]; // ok fits void setup() { // put your setup code here, to run once: } void loop() { // put your main code here, to run repeatedly: i[9]=i[8] ; }
×