Jump to content
43oh

DavidEQ

Members
  • Content Count

    38
  • Joined

  • Last visited

  • Days Won

    1

Reputation Activity

  1. Like
    DavidEQ got a reaction from Rickta59 in web site / blog like 43oh for STM32?   
    I never really found one for STM32 up to the level 43oh is for the 430.
     
    The best I found is here http://www.emcu.it/STM32.html Its in Italy but the page is in english. Lots of good info there.
     
    There is a $7.99 STM32F0 Discovery out now, but I am sticking with the F4 version.
     
    The big problem is free development tools. A must for me.
     
    Apple/Mac you can build your own GCC using info here
    posting.php?mode=reply&f=31&t=1456
     
    PC you can use prebuilt ones available from the ARM people here https://launchpad.net/gcc-arm-embedded
     
    The mac scripts build from the source files there.
     
    The STM32 forum I like the most (well its really for the Arduino stm32 leaf labs maple, but covers most STM32 topics) is herehttp://forums.leaflabs.com/
     
    Lastly what I am going to try next is http://www.coocox.org/ full free IDE and RTOS for arm including STM32 F1 F2 F4
    I will have to run that in bootcamp, PC only
  2. Like
    DavidEQ got a reaction from oPossum in web site / blog like 43oh for STM32?   
    I never really found one for STM32 up to the level 43oh is for the 430.
     
    The best I found is here http://www.emcu.it/STM32.html Its in Italy but the page is in english. Lots of good info there.
     
    There is a $7.99 STM32F0 Discovery out now, but I am sticking with the F4 version.
     
    The big problem is free development tools. A must for me.
     
    Apple/Mac you can build your own GCC using info here
    posting.php?mode=reply&f=31&t=1456
     
    PC you can use prebuilt ones available from the ARM people here https://launchpad.net/gcc-arm-embedded
     
    The mac scripts build from the source files there.
     
    The STM32 forum I like the most (well its really for the Arduino stm32 leaf labs maple, but covers most STM32 topics) is herehttp://forums.leaflabs.com/
     
    Lastly what I am going to try next is http://www.coocox.org/ full free IDE and RTOS for arm including STM32 F1 F2 F4
    I will have to run that in bootcamp, PC only
  3. Like
    DavidEQ got a reaction from AaronInSpace in Non-ADC-driven PWM servo control with Launchpad   
    Old analog scopes go real cheap anymore, maybe $100 or even free to a good home. Almost like kittens.I got a new Rigol scope I love for $400 digital with all the bells and whistles, 50 Mhz but easy hack to make it a true 100 Mhz if you need to, software only. I have not done it yet no need 50 is fast enough so far.
     
    Cheap ones on ebay:http://business.shop.ebay.com/Oscilloscopes-/104247/i.html?LH_Price=..100%40c&rt=nc&LH_ItemCondition=3000&_dmpt=BI_Oscilloscopes&_fln=1&_mPrRngCbx=1&_ssov=1&_trksid=p3286.c0.m282
     
    One I just bought new and love http://www.saelig.com/PSBEB100/PSPC016.htm
  4. Like
    DavidEQ reacted to oPossum in 14 cycles to toggle a bit in a loop?   
    It is 7 cycles per loop iteration, the asm code generated by the compiler is...
     

    xor.b #64, &P1OUT // 5 clock cycles jmp $ - 6 // 2 clock cycles
     
    It can be reduced to 6 cycles with assembly...
     

    __asm(" mov #64, R15"); __asm(" xor.b R15, &P1OUT"); // 4 clock cycles __asm(" jmp $ - 4"); // 2 clock cycles
     
    This is 10 cycles per toggle...
     

    __asm(" mov #64, R15"); __asm(" bis.b R15, &P1OUT"); // 4 clock cycles __asm(" bic.b R15, &P1OUT"); // 4 clock cycles __asm(" jmp $ - 8"); // 2 clock cycles
     
    You can enable SMCLK output on a pin to measure the clock directly.
  5. Like
    DavidEQ reacted to bluehash in web site / blog like 43oh for STM32?   
    This looks like the official st forums.
  6. Like
    DavidEQ reacted to oPossum in 32 bit simple accumulate   
    In C

    unsigned long phase_inc; unsigned long phase_acc; phase_acc += phase_inc;
     
    In assembly

    .bss phase_inc, 4 .bss phase_acc, 4 add &phase_inc, &phase_acc addc &phase_inc + 2, &phase_acc + 2
     
    Variables are passed in R12 to R15, and then the stack.
    slau132d section 6.4.1 page 100, section 6.5 page 102
  7. Like
    DavidEQ reacted to oPossum in 32k interupts a second?   
    That is correct. The low pass filter is important to get a good sine wave at near 50% the sample rate. A 12 db/oct sallen-key or similar filter is generally practical for 40% of sample rate.
     
     
    The dsPIC33FJ128GP802 is also great chip for audio synth. It has dual 16 bit oversampling audio DACs and comes in DIP and SMD packages. It is about twice as fast as the fastest MSP430.
     
    It have written several variations of NCO code for the dsPIC in assembly. Here is an example of a NCO with interpolation and level control...
     

    sl osc01_phacch, WREG ; Get phase accumulator whole * 2 and W0, W1, W0 ; Limit to table size add osc01_wave, WREG ; Add to wave table address mov.d [W0], W2 ; Get 2 samples from wave table (Sample[phase] and Sample[phase + 1] ) sub W3, W2, W3 ; Calculate Sample Delta ( Sample[phase + 1] - Sample[phase] ) mov osc01_phaccl, WREG ; Get phase accumulator fraction mul.us W0, W3, W4 ; Multiply Phase Fraction * Sample Delta add W2, W5, W4 ; Sample = Sample[phase] + ( (Phase Fraction * Sample Delta) >> 16 ) mov osc01_level, W5 ; Get level mac W4 * W5, A ; Multiply sample * level and add to voice mov osc01_phincl, WREG ; Get phase increment LSB add osc01_phaccl ; Add to phase accumulator LSB mov osc01_phinch, WREG ; Get phase increment MSB addc osc01_phacch ; Add to phase accumuator MSB with carry from LSB add
  8. Like
    DavidEQ reacted to Mac in 32k interupts a second?   
    Sine or square wave output, David? A simple NCO (numerically controlled oscillator) might work but generating a 4 kHz sine wave from a 32 kHz loop would only provide eight (8) sine samples per cycle so a 4 kHz output would be a crude looking sine wave.
     
    If you do decide to look at an NCO based frequency generator solution, there are some useful clock and sample frequencies that make it a little easier to come up with the phase offset value for the phase accumulator. For example, a 16,777,216 Hz DCO frequency, a 24 bit phase accumulator, and a 104,857.6 Hz sample/loop frequency (160 cycles) would allow specifying the phase offset as fout * 10 << 4. That is, a frequency of 254.1 Hz would have a phase offset of 2541 << 4, so much easier to compute for a continuously variable frequency generator. On the other hand, if you're working with a table of fixed output frequencies (not variable), a const array of phase offset values and almost any oscillator and loop frequency should work fine.
     
    Forum member oPossum posted an excellent NCO example that's well worth studying; Fraunchpad Poly Synth. I added comments to one section of his code showing one way to derive phase offset values;
     

    /* * Accumulator width = 2^24 * Fres = 32000/2^24 = 0.0019073486328125 Hz (frequency resolution) * Phase offset = Fout / Fres * Phase offset = 6644.87457275391 / 0.0019073486328125 = 3483828.00000000196608 */ static unsigned long notes[12] = { 3483828, // 116 G#8 6644.87457275391 3690988, // 117 A8 7040.00091552734 3910465, // 118 A#8 7458.62007141113 4142993, // 119 B8 7902.13203430176 4389349, // 120 C9 8372.01881408691 4650353, // 121 C#9 8869.84443664551 4926877, // 122 D9 9397.27210998535 5219845, // 123 D#9 9956.06422424316 5530233, // 124 E9 10548.0823516846 5859077, // 125 F9 11175.3025054932 6207476, // 126 F#9 11839.8208618164 6576592 // 127 G9 12543.8537597656 };
     
    Regards, Mike
  9. Like
    DavidEQ reacted to oPossum in 32k interupts a second?   
    That is linear interpolation. It allows the use of a smaller sine table with reasonable distortion.
     
    In this specific case it could be eliminated with little affect on quality. If the size of the sine table was reduced, then it would be much more important.
     
    If you are going to look at audio with a 'scope, then an analog scope is generally better than a digital. Just listening to audio can often reveal problems that are hard to see on any scope.
     
    For audio work a distortion analyzer and spectrum analyzer (not a scope with FFT) are extremely useful, but quite expensive for anything of good quality.
  10. Like
    DavidEQ got a reaction from oPossum in 32k interupts a second?   
    :?: I just got a launchpad, some larger flash chips and a LCD and have a question.
     
    Can the watch crystal fire an interrupt 32k times a second?
     
    I want to make some tones and use it to clock a phase accumalator.
     
    For the output I plan to look up the desired output from a look up table indexed via the phase acumalator and compare it to the adc reading every time the acc updates. If its low I will set a pin high else it will be set low.
     
    Does this look doable an anyone got any code bits to help someone still getting all the info together?
×
×
  • Create New...