grim 0 Posted August 14, 2012 Share Posted August 14, 2012 I'm unable to get the two ADC examples in the C2K Launchpad folder to work. - Example_2802xAdcTempSensor - Example_F2802xAdcSoc adc_isr fails to trigger. Quote Link to post Share on other sites
grim 0 Posted August 14, 2012 Author Share Posted August 14, 2012 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); Quote Link to post Share on other sites
msptest6 0 Posted August 14, 2012 Share Posted August 14, 2012 Is the PWM clock enabled? After CLK_enableAdcClock(myClk); Add CLK_enablePwmClock(myClk, PWM_Number_1); Does it help? grim 1 Quote Link to post Share on other sites
grim 0 Posted August 14, 2012 Author Share Posted August 14, 2012 Better. the ePWM1 registers now change. But still adc_isr still does not trigger. Thanks for the quick reply. Quote Link to post Share on other sites
TomKraut 17 Posted August 14, 2012 Share Posted August 14, 2012 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 Quote Link to post Share on other sites
grim 0 Posted August 14, 2012 Author Share Posted August 14, 2012 My suggestion would be to try running the adc examples from v1.29. You get a much better understanding of the Piccolo that way. Where can I find these examples? Thanks. Quote Link to post Share on other sites
SugarAddict 227 Posted August 14, 2012 Share Posted August 14, 2012 http://www.ti.com/tool/sprc832 It's basically the commented code in the ADC example. msptest6 1 Quote Link to post Share on other sites
TI_Trey 38 Posted August 14, 2012 Share Posted August 14, 2012 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. grim and msptest6 2 Quote Link to post Share on other sites
msptest6 0 Posted August 14, 2012 Share Posted August 14, 2012 Thanks. I missed out on the Time base sync. There is another adc example(temp adc) with the same problem. Quote Link to post Share on other sites
grim 0 Posted August 14, 2012 Author Share Posted August 14, 2012 Thanks Trey. It works now. Quote Link to post Share on other sites
piranha32 0 Posted September 6, 2012 Share Posted September 6, 2012 Trey, thanks for the hint about adding CLK_enableTbClockSync. I was going to post a question about AdcSoc example, but this thread solved my problem. Quote Link to post Share on other sites
TI_Trey 38 Posted September 6, 2012 Share Posted September 6, 2012 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 Quote Link to post Share on other sites
piranha32 0 Posted September 6, 2012 Share Posted September 6, 2012 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. Quote Link to post Share on other sites
Rousseau 0 Posted March 22, 2013 Share Posted March 22, 2013 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. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.