Jump to content
43oh

basil4j

Members
  • Content Count

    76
  • Joined

  • Last visited

Posts posted by basil4j

  1. Hi All,

     

    I am trying to generate a PWM output using TimerA, which I also want to trigger an interrupt at TACCR0.

    There is nothing in the manual that suggests I cant do this, but for some reason the interrupt is not firing, even though PWM is working as expected.

     

    Here is how I set it up, can anyone spot anything obvious?

    #define PWMOUT BIT2;
    P1OUT &= ~PWMOUT; // output 0 to start with
    P1DIR |= PWMOUT; // set as output
    P1SEL |= PWMOUT; // select timer OUT
    TA0CCR0 = PWM_FREQ_CLKS - 1; 
    TA0CCR1 = PWM_DUTY_CLKS; 
    TA0CCTL1 |= OUTMOD_7; // setup pwm output mode 
    TA0CCTL0 |= CCIE; // enable interrupt 
    TA0CTL |= (TASSEL_2 + MC_1 + TAIE); // start timer, enable interrupts
    
    

    and the ISR

    #pragma vector=TIMER0_A0_VECTOR //Timer A0 CCR0.
    __interrupt void PWM_Cycle(void)
    {
    	TA0CCR1 = PWM_DUTY_CLKS;
    	Measured_COMM_PWM_Counts++;
    }
    
  2. No you can't, the digital I/O and operating voltage of the MSP430G2 launchpad (assuming you're using that) is 3.6 volts, so 3.3 volts should be fine.

    However, the Analog output is not capable of using that entire voltage range! IIRC the ADC can sample voltages up to 1.5 volts. The ADC input voltage is up to 2.5 volts.

     

    You know the easiest way to change your current of 4-20mA into a voltage is to use a resistor.

    Assuming the ADC input resistance is infinite, a current of 20mA converted to 1.5 volts is 1.5/20m = 75 ohms, the resulting voltage for 4mA will then be 4m * 75 = 0.3 volts

    Assuming the ADC input resistance is infinite, a current of 20mA converted to 2.5 volts is 1.5/20m = 125 ohms, the resulting voltage for 4mA will then be 4m * 125 = 0.5 volts

     

    Maybe i'm misreading, but I thought the MSP430 analog input range was 0 - Vcc not 0 - 2.5V?

    ADC10CTL0, SREFx = 000 sets Vref+ to Vcc, and VRef- to Vss

  3. Ok I've been doing some thinking/testing and I think the internal pullups will work. A question remains however. What effect will the voltage divider which precedes the pullup have? I'm trying to nut it out, and all I can conclude is that the low resistance resistor in the VDiv which is attached to ground will fight with the high resistance pull up, the result being the input is pulled low.

  4. Hi All,

     

    Been a while since ive posted, but have picked up a little BLDC project again.

     

    I have designed a PCB for this BLDC controller im making, but have put pull-down resistors on the hall sensor inputs instead of pull-ups, which are what I need for the particular motors I want to drive. Stupid mistake.

     

    The manufacturers own BLDC controller uses 20k pull ups on their controllers, and I note the MSP430G2553's internal pull ups are 35k (20k-50k). If i were to just leave off the pull-downs on my PCB and use the internal pull ups, are they generally good enough to do the job?

     

    Ive never used the MSP internal pull-ups/downs before so dont know what to expect.

    This would save getting some new boards made, ill fix it with the next revision.

     

    EDIT: Maybe an important bit of info. The hall sensors are 5V, so I have a voltage divider dropping the level to 3.3V. This is jointly acting as the pulldown. (5v through 270R to MSP430, pulled to ground via 470R). 

     

    Thanks!

     

    Alec

  5. Ok ill try to outline my application a bit more.

     

    My customer is building a piece of machinery for a fertlizer truck which requires 4 BLDC motors to spin an attachment (one device per motor). I cant go in to too many details as i'm under NDA's and patents are pending etc etc, but from the motors point of view the attachments are effectively flywheels.

     

    The role of my controller is simple. There will be 1 per motor. When power is applied (24VDC from trucks batteries), ramp the motors to 500RPM in 2 seconds and stay there. When power is removed, motors can coast to a stop. That is all.

     

    The motor and controller will be housed together in a sealed stainless steel enclosure, with a gland for the power cable to enter. The power come from the battery via a relay and fuse. There are no other external connections. Nearby there will be some 0-10V operated proportional valves but these are on a separate power and control circuit.

     

    I have been asked to focus on reliability, so will add over current (hence the current sense) and over temperature protection.

     

    The motors are maxon EC Flat 90W which are 48V motors, 2.27A nominal current. The rest of the specs are on the referenced link.

     

    At 44RPM/V I will be operating these on 24V at ~47% duty cycle @ 20kHz to give me 500RPM. I could operate them on 12V at ~97% duty but I want the option to operate at max ~1000RPM is customer changes his design and 12V wont allow me to do this.

     

    I will be driving the motor using DMN4020LFDE FET's (rated to 8A continuous, 32A pulsed) which will be driven by a FAN7888 with a 12V gate output voltage.

    the design is largely based off the work by lgbeno which he has open sourced but with a few alterations to suit my application.

     

    Here is the schematic so far. The work in progress is the TVS in the top right. I have chosen the SMA6J24A-TPMSCT

     

    Im having trouble posting replies with images embedded, so please excuse me for this link...

     

    https://docs.google.com/uc?export=download&id=0B1BqLgL5jaHXZmMyUnpyM3FMZ1k

  6. There has to be some source resistance ahead of the TVS or it's max current will be exceeded and it will fail or be damaged. TVS are tough devices, but they have limits that must not be exceeded.

    Thanks, so if I simply add a low value resistor before the TVS I should be ok? I figure this will protect the current sense IC also so I wouldn't need anything like in the current sense datasheet I linked a snippet of? 

    Would this be the correct thinking?

  7. Very weird, im having serious issues trying to reply. Whenever I reply with an embedded image, the post dissapears?...
     
    Hi Zeke,
    Not yet, alas the opportunity for prototyping is rare with this project. This is being retro fitted to a fertilizer truck down the other end of the country, which I don't have access to.
    I have played around a bit with the layout and the traces are now only 10mm long and surrounded by nice ground pours so it shouldnt be a problem.
     
    My next question is about TVS diodes :)
     
    I had planned on simply putting a TVS diode across the battery input terminals, before the sense resistor. But then I found this in the current sense datasheet and im wondering if I need to change things or will my current scheme work just as well?

     

    https://docs.google.com/uc?export=download&id=0B1BqLgL5jaHXWW12X1JoODVhWXM

  8. Hah all good :)

     

    For what its worth, I have a ground pour on all layers and have tried to space susceptible traces out enough that the ground pour surrounds them.

     

    0.1uf decoupling on all power pins on all IC's, a couple of larger ones on the various LDO's. All diodes and caps on the battery or 12V power supplies are rated to 50V, all on 3.3v are rated to 16V.

     

    I have put an TVS across the battery input terminals. Don't know much about them but I think I got it right :) The controller will be connected to the motor by about 5cm of cable, both inside the same sealed enclosure. The only external connection to this controller is the battery and motor, therefore the battery input is the only one I would think need protection?, hence the TVS.

     

    Hope I'm taking enough precautions :)

  9. Hi All,

     

    With the help if lgbeno I am laying out an MSP430 based BLDC controller.

     

    I wish to add over current protection by taking the output from an INA199 current sense ic into a comparator input on the MSP430.

     

    Due to space restraints and general layout niceness I have the MCU diagonally opposite the power input, beside which I have located the shunt resistor.

     

    The board is small, 45mm x 35mm so this may be an irrelevant question.

     

    My question is:

     

    Is it best to locate the sense ic near the MCU, thus reducing the length of the Vout trace but increasing the length of the Vin + and - traces (they would run parallel to each other).

     

    Or is it best to locate the sense ic near the shunt and have a longer Vout trace?

     

    This is a 4 layer board, gnd-gnd-power-gnd planes. The top side has the high freq traces (20khz pwm and hall inputs). The current sense traces are on the bottom.

     

    This is an automotive application so I am trying to make it as immune to electrical noise as possible. Would a small amount of noise even matter for over current protection? I would have safety margins built in.

     

    Thanks for the input!

     

    Regards, Alec

     

    Sent from my GT-I9300 using Tapatalk

  10. G2452 should work, G2412 would be ok if you don't have a use for an ADC, which it sounds like you do not.

     

    Using a timer for speed detect is more of a nice to have than anything. For the simplicity of this design, you can just use the one timer and CPU and get fine accuracy.

     

    How many of these things are you making?

     

    About 100 per year is an estimate. I'm in New Zealand, so our volumes aren't quite as high as most other countries!

  11. There is nothing particularly secret about this project. I'm in sales, but I have a customer who is somewhat lacking in electrical knowledge ask me to create a small BLDC controller for him so he doesn't have to use the awesome, but massively over-speced (for his application) controller from Maxon. This wont be commercialised beyond that so happy to contribute where I can.

     

    I am a bit of a novice, and really only know enough to adapt what I read online from projects like yours so hopefully I can add something.

     

    I planned to use the MSP430G2452 to keep the size down*, but I hadn't thought about using timers to measure the speed from the hall sensors! Might as well keep it simple and use what you've made available.

     

    * I have a goal to keep it below 25mm x 50mm. I have been given a very limited space in a sealed enclosure, right behind the motor. Fertilizer does nasty things to electronics, so we are trying to keep everything together in one compact unit to avoid unnecessary connectors.

  12. What is really funny is that I did my testing on the same Maxon Motor!ne3uhavu.jpg

     

    Oh nice haha. This is a bit off the subject of the original thread, but seeing as it was pointless anyway ill ask anyway :)

     

    My customer is using the 48V version on a farming truck (4 of them). How do you think the components you have chosen would last in an industrial situation with lots of vibrations etc?

    Reliability is the key for my customer so i'm wanting to keep operating temperature down and over spec the FET's. 

     

    I was planning on using FETs and a FAN7388 driver IC, but it looks like you used NPN transistors??

    EDIT: Just noticed your PRO version used a FAN7888 which must be similar :) They say imitation is the highest form of flattery...prepare to be flattered :) *With credit given of course!*

     

    I was also considering operating the PWM at 55kHz as that is what the Maxon ESCON 36/3 controller operates at. How did you find the lower frequency you have chosen operates?

  13. Hi Alec, seems to me that of your motor has hall sensors, use them! You will get much better reliability than a sensor less algorithm. They also help with speed. I have a pretty old project called BLDC booster for MSP430g2553 that you can check out of git hub: https://github.com/lgbeno/BLDC-Booster. Don't get me wrong instaspin is cool be no need making if more difficult on yourself...

    Hi there! Totally agree, see my edit at the top of the post :)

     

    I have bookmarked your project. Super useful thanks! I'll likely have a few questions but that answers a few of them :)

     

    Sent from my GT-I9300 using Tapatalk

  14. Hi All,

     

    ***I just answered my own question... InstaSpin isn't for use with hall sensors.***

     

    I have a little commission in working on and am wanting to use an MSP430 in it.

     

    My customer wants and extremely simple BLDC controller to drive a Maxon EC 90 Flat BLDC motor in a farming application.

     

    The functionality will be very simple. Power comes on, motor ramps up to 500RPM and stays there. The motor has hall sensors which I will use to keep the speed constant under load.

     

    Power turns off, motor coasts to a stop.

     

    Is InstaSpin capable of such a simple task or is it more designed for advanced motion control? This is an ongoing requirement so I want to be able to program the MSP430 once and not have to configure each and every one of them (happy to calibrate the first one of course).

     

    Thanks in advance.

     

    Alec

     

     

     

    Sent from my GT-I9300 using Tapatalk

  15. Hi Chicken,

     

    Above certain altitudes, the lapse rate changes (which is part of the exponent of the POW), so I was considering making 3 lookup tables, 1 for each lapse rate.

    This would somewhat achieve the same as what you are suggestion. Maybe I can put less samples in the low alt table, and more in the higher ones. 

     

    Altitude (m)         Lapse rate                            =1/x (exponent)

    0->11000            0.0065 some calculations     0.190267

    11000->20000     0 some calculations             0

    20000->32000     0.001 some calculations       -0.02927

     

     

    Whats the story with polynomial interpolation? Linear sounds easy, but which would be more accurate? Im not too concerned about execution time as in sure it will still be better than a POW (that is if I could get it into the RAM!)

×
×
  • Create New...