Jump to content
43oh

[Launchpad] Unable to get ADC examples to work


Recommended Posts

Some more debug info. When I step through the code in the AdcTempSensorExample, the PWM registers do not populate. myPwm however points to the right register address... 0x6800

The below code makes no change in the PWM registers:

 

//   EPwm1Regs.ETSEL.bit.SOCAEN    = 1;        // Enable SOC on A group
   PWM_enableSocAPulse(myPwm);
//   EPwm1Regs.ETSEL.bit.SOCASEL    = 4;        // Select SOC from from CPMA on upcount
   PWM_setSocAPulseSrc(myPwm, PWM_SocPulseSrc_CounterEqualCmpAIncr);
//   EPwm1Regs.ETPS.bit.SOCAPRD     = 1;        // Generate pulse on 1st event
   PWM_setSocAPeriod(myPwm, PWM_SocPeriod_FirstEvent);
//   EPwm1Regs.CMPA               = 0x0080;    // Set compare A value
   ((PWM_Obj *)myPwm)->CMPA = 0x0080;
//   EPwm1Regs.TBPRD                 = 0xFFFF;    // Set period for ePWM1
   PWM_setPeriod(myPwm, 0xFFFF);
//   EPwm1Regs.TBCTL.bit.CTRMODE     = 0;        // count up and start
   PWM_setCounterMode(myPwm, PWM_CounterMode_Up);

Link to post
Share on other sites

Man, that code is a mess! I don't think I like the new driver library... like, at all! With the old one you could see where something went wrong just from reading the code. Now you have to read through dozens of headers and source files just to see what's going on...

 

My suggestion would be to try running the adc examples from v1.29. You get a much better understanding of the Piccolo that way.

 

Cheers

TomKraut

Link to post
Share on other sites

Sorry about the troubles with the examples. The driver library is still very new and will grow as it matures and becomes easier to use.

 

I took a look at the examples and it looks like they are missing a few clock enables.

 

Try replacing this:

 // Perform basic system initialization
WDOG_disable(myWDog);
CLK_enableAdcClock(myClk);

with this:

 // Perform basic system initialization
WDOG_disable(myWDog);
CLK_enableAdcClock(myClk);
CLK_enableTbClockSync(myClk);
CLK_enablePwmClock(myClk, PWM_Number_1);

 

I apologize for how dirty those examples are. The other examples for the LaunchPad aren't that way and I will get these fixed in the next release.

Link to post
Share on other sites
  • 4 weeks later...

No, problem. Once again, sorry for the trouble. All this stuff is still very new and ya'll are the first brave souls (beside myself) to test this stuff out (its only been public for a month). With any new software there are going to be a few bugs to be worked out, but I'm confident that with this community's help we can get the software polished and some amazing projects developed with this board.

 

Trey

Link to post
Share on other sites

No, problem. Once again, sorry for the trouble. All this stuff is still very new and ya'll are the first brave souls (beside myself) to test this stuff out (its only been public for a month). With any new software there are going to be a few bugs to be worked out, but I'm confident that with this community's help we can get the software polished and some amazing projects developed with this board.

 

I'd like to say that I really appreciate your help. I realize that the project is new and I don't expect it to be completely flawless. It's really important that there is a place where problems can be reported and that they are solved quickly.

I found the forum through a link to a code snippet posted in a discussion on TI forums or buried somewhere in TI wiki (I don't remember). It think it would be worth to give it a little bit more publicity.

 

regards,

j.

Link to post
Share on other sites
  • 6 months later...

I was having the same problem with de Lauchpad in ADC_SOC Example. I did the change that Trey purpose but something is still wrong. I cant read the Voltage1[10] value, just the Voltage2[10]. I've tried everything, as try to read just one channel, but didnt work though.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...