• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Embedded Software » StarterWare » StarterWare forum » DMTimer register write issue
Share
StarterWare
  • Forum
Options
  • Subscribe via RSS

Forums

DMTimer register write issue

This question is answered
Christian Lambricht
Posted by Christian Lambricht
on Aug 05 2012 07:18 AM
Prodigy100 points

Hello,

When I activate the CACHE_ALL in my code i get some strange behavior.

The DMTimerPreScalerClkEnable() function seems not working correctly.

After some investigation, I remarks that when I write to a DMTimer register and directly read that register, the data read doesn't reflect the data written before....If I wait for some delay before reading data, the data is correct.

Thus, I add some line in the DMTimer driver code (starterware) to wait until the data is correct.

void DMTimerPreScalerClkEnable(unsigned int baseAdd, unsigned int ptv)
{
    /* Clear the PTV field of TCLR */
    HWREG(baseAdd + DMTIMER_TCLR) &= ~DMTIMER_TCLR_PTV;
    while((HWREG(baseAdd + DMTIMER_TCLR) & DMTIMER_TCLR_PTV));

    /* Set the PTV field and enable the pre-scaler clock */
    HWREG(baseAdd + DMTIMER_TCLR) |= (ptv & (DMTIMER_TCLR_PTV | DMTIMER_TCLR_PRE));
    while(ptv != (HWREG(baseAdd + DMTIMER_TCLR) & (DMTIMER_TCLR_PTV | DMTIMER_TCLR_PRE)));
    
}

My question is "Is it a normal behavior ???"

FYI, I remark that also with another 32KHz clock source and without any cache activated...

Best regards,

Christian Lambricht

DMTimer write read
Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Madhvapathi Sriram
    Posted by Madhvapathi Sriram
    on Aug 05 2012 08:27 AM
    Intellectual465 points

    Hi Christian,

    Christian Lambricht
    When I activate the CACHE_ALL in my code i get some strange behavior

    I believe, I/O space is not made cacheble for exactly the same reason you are observing.

    Since, I/O registers are prone to side effects (like self-clear-after-set, strict ordering requirements and so on), I/O register space should not be cached. Else, instead of seeing the actual values you may see the cached results. I hope I am right.

    You should maintain a cache table and only enabling data caching on those regions that are not I/O mapped (in your case all the peripheral registers)

    Christian Lambricht
    My question is "Is it a normal behavior ???"

     I guess so.

     Thanks and regards,

    Madhvapathi SRiram

    Thanks and regards,

    Madhvapathi Sriram

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Christian Lambricht
    Posted by Christian Lambricht
    on Aug 06 2012 02:15 AM
    Prodigy100 points

    Hello,

    First, thank you for your reply.

    Maybe your are right, I don't know but when I configure The DMTimer to use the 32KHz for the clock sourcing and when I disable all cache I have the same issue.

    When I write to register and directly read, I don't have the value written..... I have to wait some times to view the correct value.

    If you take a look at the platform code in Starterware (beaglebone or ) you will see that the code add some "while" to wait until the value is corectly written... Thus my question is why in the Drivers it is not the case. Why there is a different coding style between platform code and driver code?

    Best regards,

    Christian

    Starterware am335x DMTimer write read
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Jeethan Castelino
    Posted by Jeethan Castelino
    on Aug 07 2012 05:26 AM
    Prodigy720 points

    Hi Christian,

    The ''while'' loops present in the StarterWare platform's are not required and will be removed in the next release. On commenting the while loops in the StarterWare platform's the existing(default) dmtimer example application will work fine.

    While loops in the driver are used, only when the Technical reference manual(TRM) says so(In this case not required). Adding while loops in every API/function will add overheads and reduce performance. Hence while loops are not used.

     Regards,

    Jeethan

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Christian Lambricht
    Posted by Christian Lambricht
    on Aug 07 2012 09:06 AM
    Prodigy100 points

    Hi Jeethan,

    Try this, configure DMTimer to use 32KHz clock instead of 24MHz clock. Then write to prescaler register and directly read the value.... You will see that you will have to wait some time until the value is updated....That produce side effect when you don't wait with while :)

    If you use the DMtimer in 24MHz you will have the same issue only if you active CACHE_ALL....

    I don't know if I will have the same issue with the dmtimer example but this example never activates the CACHE_ALL.

    Best regards,

    Christian

    Starterware am335x DMTimer
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Jeethan Castelino
    Posted by Jeethan Castelino
    on Aug 09 2012 03:44 AM
    Prodigy720 points

    Hi Christian,

    I enabled the DMTimer pre-scaler counter and faced the similar issue with 32KHz input clock. The timer control register was not getting updated(TCLR).

    This is because the POSTED mode of DMTimer is enabled by default(POSTED field of TSICR register is set). When POSTED mode is used software is supposed to poll for a bit before writing into TCLR register.

    I polled for the "W_PEND_TCLR" field of Timer write posted status register(TWPS) and after that i enable and configure the prescaler clocks. It works.

    Please try this configuration.

    Regards,

    Jeethan

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Christian Lambricht
    Posted by Christian Lambricht
    on Aug 10 2012 03:01 AM
    Verified Answer
    Verified by Christian Lambricht
    Prodigy100 points

    Hi Jeethan,

    I think you are right ... You pin point the issue.

    So,  the dmtimer dirver (starterware) doesn't support posted mode!!Indeed the code below makes a write and a read (masking) without taking into account the posted mode .... Am I right?

    See:

    void DMTimerPreScalerClkEnable(unsigned int baseAdd, unsigned int ptv)
    {
        /* Clear the PTV field of TCLR */
        HWREG(baseAdd + DMTIMER_TCLR) &= ~DMTIMER_TCLR_PTV;
        /* Set the PTV field and enable the pre-scaler clock */
        HWREG(baseAdd + DMTIMER_TCLR) |= (ptv & (DMTIMER_TCLR_PTV | DMTIMER_TCLR_PRE));
    }

    Best regards,

    Christian

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Jeethan Castelino
    Posted by Jeethan Castelino
    on Aug 10 2012 05:13 AM
    Prodigy720 points

    Hi Christian,

    Yes you are right.

    Regards,

    Jeethan

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use