This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Missing Driverlib Functions for PWM Clock and ADC Speed

I just moved our current project from Stellarisware to TivaWare on a LM4F232H5QDF micro.  I found with the new version (TivaWare 1.0) that the code to run the PWM and ADC was shutting down after I set the clock rate for the ADC using SysCtlADCSpeedSet().  After much investigation, it seems the register RCGC0 has been moved to a legacy option in the new micro.  I looked for the new functions ADCSpeedSet() and PWMClockSet() but they are not in the new library to access the new registers ADCx_PC_R/ADC_O_PC and PWMx_PC_R/PWM_O_PC (PWM_O_PC is also missing from hw_pwm.h).  Could these functions be added in the next update along with the associated bit field defines where they are also missing please?  

Thanks,

Tim

  • Feel your pain.  Believe your, "clock rate for the ADC using SysCtlADCSpeedSet()" issue appeared - and had work-around - this or original Stellaris forum.  Your RCGC0 Reg "find" is precisely what I recall in that earlier post.

    IIRC there are 2 new (master) PWM Registers (in LX4F parts) which better manage PWM - and possibly the control/trigger of the ADC.   

    May be bit "too soon" to attempt full "migration" - early models of both cars, jet aircraft and rebrand SW - often evidence such "growing pains..."   "Pioneers" often marked by "arrows" embedded in "soft tissue" - and lure/promise of "free land" seems "thing of the past..."

  • Hi,

    There are some problems with SysCtlADCSpeedSet() - but a workaround is presented in this thread.

    Petrei

  • Yes, there are ways to get it working and that wasn't what my post was for.  I was looking to get the library functions in the new library.  I had already implemented a work-around by adding the functions to the library myself.  However, I will point out that the work-around in that thread may make the ADC run when you call the SysCtlADCSpeedSet and then the SysCtlPeripheralEnable but when you call the function SysCtlADCSpeedSet it disables the PWM peripheral I already had enabled, configured and running.   Therefore there is more to the issue than just setting the ADC speed and it would be better to have the correct library functions implemented so using the ADC doesn't break the PWM.

  • It looks to me as if SysCtlADCSpeedSet() should have been removed in the StellarisWare->TivaWare move. For Tiva parts, including the existing Blizzard-class parts, the ADC speed is now set through new registers in the ADC itself rather than via the legacy SysCtl RCGC0 register.

    The legacy registers are still in SysCtl on Blizzard parts alongside the new peripheral-specific registers so that's likely causing your problems. If you enable the peripheral using SysCtlPeripheralEnable() it will write to the new register (for example RCGCADC for the ADC rather than RCGC0 on older parts) but when the code then goes and performs a read-modify-write on RCGC0 (the legacy register accessed by SysCtlADCSpeedSet()), it will likely mess up the state of the other peripherals which share this register for their enables on the older parts.

    I'll raise a problem and get this looked into for the next release.