586,119 active members*
3,493 visitors online*
Register for free
Login

Thread: dsPic-Servo

Page 6 of 9 45678
Results 101 to 120 of 172
  1. #101
    Join Date
    Jan 2006
    Posts
    2985
    Quote Originally Posted by Iron-Man View Post
    Has anyone looked at the SA306...
    Iron-Man
    Looks like a cool little chip, quite similar to the ones I suggested, just a lower operating voltage.

    The only thing that would turn me away from this chip is the QFP package and heatsinking arrangement. There needs to be a cutout in the pcb and the chip is mounted upsidedown, so that the thermal pad can be attached to a heat sink. Looks like a big PITA, compared to most others I have seen.

    Matt

  2. #102
    Join Date
    Jan 2009
    Posts
    334

    dsPic Servo Power Stage / dsPic debug ?

    Thanks Matt.

    I had looked at the IRF chips before. I just may order one and start testing.
    You are right about the SA306/57 chips. I had considered it because of the development board that is available. It may be possible to make a socket/header for it and use heat sink/fan option for cooling.

    By the way, I now realize that you cannot debug dsPic devices with the pickit2.
    Has anyone tried this kit and the mikroC compiler? http://www.circuit-ed.com/font-size4...rd-P127C4.aspx

  3. #103
    Join Date
    Jan 2006
    Posts
    2985
    I have a couple of the IRAMS modules from IRF. I made a little board for it to play around with. I can post up eagle files and pictures if you're interested.

    According to microchip, the pickit2 supports programming AND debugging on the dspic30f4012. What makes you think it won't?

    http://www.microchip.com/stellent/id...cName=en027813

    The development board looks like it would be good for an educational thing, not so much for real development. It has no breadboard space and there are a ton of LED's and switches on it that take up space when they aren't used (most of the time?). I prefer the old solderless breadboard approach, but YMMV.

    Matt

  4. #104
    Join Date
    Jan 2009
    Posts
    334
    Yes, it would be great to see your Eagle files. When I went to select the debugger, the pickit2 was not selectable. I will check that I have the latest software. Also, when you look at the list of compatible chips, only specific columns and chips list "Baseline – Programming & Debugging", I do not see the dsPic30F4012, but I may be mistaken.

    Were you able to get servos working with the IRAMS module?

    As an update, I now have the servo error down to "1", since adding the new power supplies. My current redesign is about 95% complete. I plan on using the existing working board for prototype and design work.

  5. #105
    Join Date
    Jan 2006
    Posts
    2985
    A dsPIC is not considered a "baseline" part. In the link I posted, there are two columns, the left one says "programming" the right says "programming and debugging". I took that to mean that the whole column was a list of devices which can be debugged. The dspic's are listed twice, once in each column. Are you using MPLAB 8.20? I have v8.20a installed now. If you go to:
    C:/Program Files/Microchip/MPLAB IDE...ce Support.htm
    There is a chart, part of it posted here, that shows the dspic30 parts as "green light" on both programming and debugging with pk2. I have never used my pickit for debugging anything, so I can't speak from experience, but it looks like you should be able to do it.

    I haven't tried a DC servo with it, but I played around with a 3 phase induction motor and 3 phase servo a little. I just wrote some basic code to generate a sine wave with the PWM, no feedback or anything. The module seems to work fine, the motor turns as it should. I have been wanting to play around with it more but have been too busy recently to do anything with it.

    I'll post up what I have on my IRAMS board when I get a chance.
    Matt

  6. #106
    Join Date
    Jan 2006
    Posts
    2985
    Attached are the eagle files. The "AC Servo Module.brd" is the one I made, the others in there are just random thoughts.

    Pictures of assembled board to follow Edit: Attached.
    Matt
    Attached Thumbnails Attached Thumbnails 100_2190.jpg   100_2191.jpg  
    Attached Files Attached Files

  7. #107
    Join Date
    Jan 2009
    Posts
    334

    Eagle files

    Matt

    Thanks for the files.

  8. #108
    Join Date
    Aug 2006
    Posts
    21

    compiling errors please help

    hi Max-Mod im truing to compile your unified source code and get following errors please help

    Clean: Deleting intermediary and output files.
    Clean: Done.
    Executing: "C:\Program Files\Microchip\MPLAB C30\bin\pic30-gcc.exe" -mcpu=30F4012 -x c -c "capture.c" -o"tmp\capture.o" -g -Wall
    Executing: "C:\Program Files\Microchip\MPLAB C30\bin\pic30-gcc.exe" -mcpu=30F4012 -x c -c "commands.c" -o"tmp\commands.o" -g -Wall
    Executing: "C:\Program Files\Microchip\MPLAB C30\bin\pic30-gcc.exe" -mcpu=30F4012 -c "DataEEPROM.s" -o"tmp\DataEEPROM.o" -Wa,-g
    Executing: "C:\Program Files\Microchip\MPLAB C30\bin\pic30-gcc.exe" -mcpu=30F4012 -x c -c "encoder.c" -o"tmp\encoder.o" -g -Wall
    Executing: "C:\Program Files\Microchip\MPLAB C30\bin\pic30-gcc.exe" -mcpu=30F4012 -x c -c "main.c" -o"tmp\main.o" -g -Wall
    Executing: "C:\Program Files\Microchip\MPLAB C30\bin\pic30-gcc.exe" -mcpu=30F4012 -x c -c "pid.c" -o"tmp\pid.o" -g -Wall
    Executing: "C:\Program Files\Microchip\MPLAB C30\bin\pic30-gcc.exe" -mcpu=30F4012 -x c -c "pwm.c" -o"tmp\pwm.o" -g -Wall
    pwm.c:230:6: warning: #warning "WH set up for sign/mag on PWM1"
    Executing: "C:\Program Files\Microchip\MPLAB C30\bin\pic30-gcc.exe" -mcpu=30F4012 -x c -c "save-res.c" -o"tmp\save-res.o" -g -Wall
    save-res.c: In function 'save_setup':
    save-res.c:101: warning: implicit declaration of function '_wait_eedata'
    save-res.c:73: error: Argument to __builtin_tbloffset() is not the address of an object in a code, psv, or eedata section
    save-res.c:73: error: Argument to __builtin_tblpage() is not the address of an object in a code, psv, or eedata section
    save-res.c: In function 'clear_EE':
    save-res.c:112: warning: implicit declaration of function '_erase_eedata_all'
    save-res.c: In function 'restore_setup':
    save-res.c:126: warning: passing argument 1 of '_memcpy_p2d16' from incompatible pointer type
    save-res.c:124: error: Argument to __builtin_tbloffset() is not the address of an object in a code, psv, or eedata section
    save-res.c:124: error: Argument to __builtin_tblpage() is not the address of an object in a code, psv, or eedata section
    Halting build on first failure as requested.
    ----------------------------------------------------------------------
    Release build of project `C:\temp\picsoft\user\unified source\sc\YAPSC_unified.mcp' failed.
    Tue Nov 10 22:46:47 2009
    ----------------------------------------------------------------------
    BUILD FAILED

  9. #109
    Join Date
    May 2007
    Posts
    106
    Hi,

    what is the version of your C30 installation? I know built-in functions have changed a bit over the compiler versions, so I guess an older version of C30 could not compile it right.
    Let me know if updating C30 works!

    Best regards
    Max

  10. #110
    Join Date
    Aug 2006
    Posts
    21

    compile errors

    Thanks Max-Mod
    that was the problem my compiler was v3 upgraded to v3.21 beta and it compile without errors

  11. #111
    Join Date
    May 2007
    Posts
    106
    good.
    Have fun!

  12. #112
    Join Date
    Aug 2006
    Posts
    21

    setup problem

    hi Max-Mod

    ive compiled the unified source for use with h bridge but
    when i program my board
    an try to set the pid parameters it seems that the program cant read the data from eeprom if i put p 0.01000 and enter it gives me back

    =
    and stay there i cant enter any new data then i work from pc rs232 port not the progkey

    thi is what i get
    capture OK
    YAPSC:V1 Version: beta 2.0.2 (13 Oct 2009)
    YTTVA1
    dspic-servo by L.Glaister
    MOSFET-H mod by MaX-MoD
    servo-enabled
    >No valid setup found in EEPROM, using defaults.

    USAGE:
    p x.x set proportional gain
    i x.x set integral gain
    d x.x set differential gain
    0 x.x set FF0 gain
    1 x.x set FF1 gain
    b x.x set deadband
    m x.x set max output current(amps)
    f x.x set max error before drive faults(counts)
    x n set pc command multiplier (1-16)
    t n set # of 100us ticks/per servo calc(2-100)
    e print current encoder count
    l print current loop tuning values
    s print internal loop components
    ? print this help
    >p 0.01>(p) =

    is there any setting that i must change when i compile for the eeprom


  13. #113
    Join Date
    May 2007
    Posts
    106
    Hmm.

    There is no need to program the EEPROM.
    Try to send "L" command. Does it also stops at the first "="?
    is the ERR led is blinking?

  14. #114
    Join Date
    Aug 2006
    Posts
    21

    program stop responding

    yes it stops at the = sighn with l command
    and when i enable the drive it stops at servo enabled =

    the error led is not blinking

  15. #115
    Join Date
    Aug 2006
    Posts
    21

    more info

    Max-Mod

    when i start up the bord error led is off as soon as i do any of the commands like L or p 0.010 the error led get a 65hz signal
    and the communication stop
    looks like as soon as it tries to read data from eeprom i get this error

    any suggestions thanks

  16. #116
    Join Date
    May 2007
    Posts
    106
    Hmm.
    I too had some troubles with the printf() function.
    Have you specified a heap? I use 100 bytes and it goes fine.

    To specify heap size, in MPLAB, go to project->build options->project->MPLAB LINK30 tab->Heap size). It worked for me at 100 bytes, and I had some issues below 20 bytes if I remember well.

    Also keep an eye on the remaining Data Memory (RAM) as the remaining is used by the stack (as far as I understood). As printf call are pretty long they get interrupted. The stack then grows up or overflows.
    This is why I limited the number of output and error samples taken during a step test to keep some room for stack. I get about 500 bytes of free RAM
    (but in this case the ERR led will be blinking)

    Other possible source of error is the power input. The printf() function is rather "CPU intensive" and the current consumption of the dsPIC rises a bit. Depending on you power supply (and capacitors used) the input voltage can drop slightly under 5V... enough to stop the oscillator. I had this problem once and it's really a HARD one to spot unless you know it
    To get sure the issue is not power input, put a small (~1uF) ceramic of tantalum cap at the Vss and VCC pins. Also check that all VDD and VSS pins are connected to either 5V and GND.

  17. #117
    Join Date
    May 2007
    Posts
    106
    just say "more precision"

    in fact the ERR led should blink 1Hz (address error), 2Hz(Math error), 5Hz (maxcount error) or 1Hz with long blink and short dark (stack error)
    At the beginning of main.c; replace the 3 trap ISR by:
    void __attribute__((__no_auto_psv__, __interrupt__)) _StackError (void)
    {
    PDC2 = PDC3 = PDC1 = 0; // turn OFF the output (0V)
    clearOUT1(); // turn OFF (high impedance) OUT1
    T1CONbits.TON = 0; // turn OFF timer 1 (and PID loop)
    while (1)
    {

    timer_test = 31;
    while ( timer_test-- )
    {
    timer_test2 = 16000;
    while(timer_test2--)setErrLed();
    }

    timer_test = 98;
    while ( timer_test-- )
    {
    timer_test2 = 16000;
    while(timer_test2--)clearErrLed();
    }
    }
    }

    void __attribute__((__no_auto_psv__, __interrupt__)) _AddressError (void)
    {
    PDC2 = PDC3 = PDC1 = 0;
    clearOUT1(); // turn OFF (high impedance) OUT1
    T1CONbits.TON = 0; // turn OFF timer 1 (and PID loop)
    while (1)
    {
    timer_test = 125;
    while ( timer_test-- )
    {
    timer_test2 = 16000;
    while(timer_test2--)setErrLed();
    }

    timer_test = 125;
    while ( timer_test-- )
    {
    timer_test2 = 16000;
    while(timer_test2--)clearErrLed();
    }
    }
    }

    void __attribute__((__no_auto_psv__, __interrupt__)) _MathError (void)
    {
    PDC2 = PDC3 = PDC1 = 0;
    clearOUT1(); // turn OFF (high impedance) OUT1
    T1CONbits.TON = 0; // turn OFF timer 1 (and PID loop)
    while (1)
    {

    timer_test = 63;
    while ( timer_test-- )
    {
    timer_test2 = 16000;
    while(timer_test2--)setErrLed();
    }

    timer_test = 63;
    while ( timer_test-- )
    {
    timer_test2 = 16000;
    while(timer_test2--)clearErrLed();
    }
    }
    }
    This fixes the blink rate issue.
    Think I'll release a 2.0.3 version this weekend... Before the next version with integrated motion controller!

    Best regards
    Max

  18. #118
    Join Date
    Aug 2006
    Posts
    21

    working

    Max-Mod

    thanks for all the help it was the heap setting ive changed it to 100 and it works

    will look out for the new version

    just another thing is there somewhere a instruction manual or file for setting up the pid parameters as i dont have experience on pid dont know where to start and how to go about setting the parameters for best performance

    thanks again for all the help got it turning a 200v 16A motor with a heavy duty h bridge that i biult with igbt as soon as i got it on cad ill post the h bridge just have to sort the current monitoring circiut out

  19. #119
    Join Date
    May 2007
    Posts
    106
    good

    I am planning to make a "tuning guide" but I have no time for it at the moment.
    this will be part of the YTT documentation.

    Waiting for your board design and some pictures of your board

    Max

  20. #120
    Join Date
    May 2007
    Posts
    106
    Hi everybody,

    here is the first release of the tuning guide:
    http://max-mod-shop.com/media/ytt/tuning guide.pdf

    let me know what you like/dislike of it!


    Best regards,
    Max

Page 6 of 9 45678

Similar Threads

  1. Replies: 0
    Last Post: 02-07-2014, 01:29 AM
  2. help me with dspic 30f4012 project
    By caligroup in forum Community Club House
    Replies: 1
    Last Post: 08-16-2010, 03:59 PM
  3. first steps with dsPIC + IRAMS AC servodrive
    By andy55 in forum Servo Motors / Drives
    Replies: 7
    Last Post: 07-10-2007, 07:55 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •