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.

Cannot use main oscillator with SysCtlClockFreqSet function

Hello,

Dev board: EK-TM4C1294XL 

Tiva™ C Series TM4C1294 Connected
LaunchPad Evaluation Kit

I am trying to use the SysCtlClockFreqSet function in the driverlib library, but cannot get it to use the main oscillator with the way they have specified (SYSCTL_OSC_INT works fine).

This line returns 0:

volatile uint32_t freq = SysCtlClockFreqSet(SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480, 50000000);

I am setting everything written in the documentation for this function, but it refuses to set the clock frequency. However, if I add SYSCTL_XTAL_25MHZ (which is not documented for this function), the frequency can be set. eg.

volatile uint32_t freq = SysCtlClockFreqSet(SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480 | SYSCTL_XTAL_25MHZ, 120000000);

This code returns 120000000, as required.

My question is SYSCTL_XTAL_25MHz is not needed for SysCtlClockFreqSet in the documentation. Was this is mistake, or am I doing something hacky?

Thanks

  • Hi Thimira ,

    You are doing the correct thing. I actualy never noticed that in the TivaWare peripheral guide under the SysCtlClockFreqSet, there wasn't any thing referring to the SYSCTL_XTAL_25MHZ like in SysCtlClockSet. I think if you don't use it, by default it should be 16Mhz internal oscilator.

     

    Now there's tests? o.O

  • Thimira G said:
    volatile uint32_t freq = SysCtlClockFreqSet(SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480 | SYSCTL_XTAL_25MHZ, 120000000);

    I have not tried setting the System Clock to run at Main Oscillator. But you are doing something wrong with this code line. You intend to run the System Clock from the Main Crystal Oscillator buy you have set it to run from PLL with this parameter SYSCTL_USE_PLL.

    See at Tivaware Peripheral Driver Library User's Guide how to set parameters at SysCtlClocFreqSet, to set your system clock to use your Main Oscillator.

    -kel

  • No, I intend to run the system clock from the PLL. The input oscillator is the Main Crystal. It's the same pattern as the example, minus the SYSCTL_XTAL_25MHZ.

  • Hello Thimira

    This is a documentation bug already identified. We will be fixing the same in the revision of the documents

    Regards

    Amit

  • Thanks Amit, let's hope  we get new documentation soon. I've seen one or another important updates needed in the past 1 or 2 months.

    I am not aware since i'm not in the forum for that long but, is there a announcement in the forum when Tiva related documents are updated?

  • Hello Luis,

    Please do post the updates needed in this thread, so that I have one thread to follow. We plan to have announcement on the forum when a new document is released.

    Regards

    Amit

  • Hi Amit,

    Well i can't remember them on the top of my head at 3am but do note that it's personal preference.

    There's what was talked about in this post.

    There's also something about the TM4C1294 being "to fast" for the i2c  http://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/t/368493.aspx

    In uDMAChannelTransferSet on TivaWare it should be noted that although uint32_t ui32TransferSize takes a 10bit number, that the function filters it so the value is from 1-1024 and not 0-1023, i hope you can understand the confusion. The datasheet correctly states the the value should be 0-1023, being  0 to transfer 1 item and 1023 to transfer 1024 itens. But the TivaWare function takes values from 1-1024.

    Now i can't remember anything else but i also don't remember what i ate at lunch so maybe i will remember something later

    I have some more but they are more of a request so i will probably email them to one of TI email (got to see which one first). It's basically more examples request for TivaWare, like Scatter-Gather on the DMA

  • Hello Luis,

    The Transfer Size id decremented by 1 before being programmed to the control structure. So I don't think that this would be a note in the driverlib documentation.

    Regards

    Amit

  • i just suggested that one because in the datasheet clearly says "insert value from 0 to 1023". But the TivaWare function accepts only values from 1 to 1024 and i only found that by looking into the source files. I made in various times to insert the value 0 in hoping i would transfer only 1 item. This of course never happened and i lost 1 hour or 2 debugging the problem

  • Hi Luis,

    I understand what you mean. From programming perspective 1-1024 is more human readable than 0-1023. But from a h/w perspective it saves a flop when implementing counters. Though may not be much, but adds up when a number of such peripherals have such good 2^x aligned counters.

    Regards

    Amit

  • Hi Amit,

    I was talking about adding a note in TivaWare under TransferSet that the value is from 1-1024.

    Right now it's just:

    The ui32TransferSize parameter is the number of data items, not the number of bytes.


    In uDMATaskStructEntry it is noted that. That it the transfersize is from 1-1024. Why not also on uDMAChannelTransferSet. It's just a tinny detail but i think it's important. I myself jumped over uDMATaskStructEntry  since i didn't want to get into scatter-gather so i missed that note of 1-1024 parameter. Well, anyway it's a sugestion. Thanks for the attention