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.

TM4C - Low level reference

Hi,


where can I find the doc on the low layer of code used in MCU programming? I refer to doc thate explain function like "SYSCTL_RCGCGPIO_R". I got no problem finding drivers datasheet but I can't find the datasheet for the low level function.

It is just for personnal fun and to increase my knownledge of the MCU that I want to programm some drivers by myself.

  • Hi Mathieu,

    Normally when not using the drivers the HWREG like macros are used.
    For learning to program with registers there only is the datasheet. There is the register map and description and some initialization examples (not code).
    You can consult the source codes for the registers macros. I think it's in pin_map.h
  • Hi,

    when you refer to datasheet, you mean the MCU datasheet?
  • Yes, if you notice the MCU does not have a reference guide distinction from the MCU datasheet - the datasheet is the reference
  • Hi,

    because I bought the tm4c129 kit, and I just want for a first step blink a led. So I modify the code from example, because they use the Pin Q but i check the design board pdf and the led are Pin N. So I wrote this:

    int
    main(void)
    {
        volatile uint32_t ui32Loop;
    
        //
        // Enable the GPIO port that is used for the on-board LED.
        //
        SYSCTL_RCGCGPIO_R = SYSCTL_RCGCGPIO_R14;
    
        //
        // Do a dummy read to insert a few cycles after enabling the peripheral.
        //
        ui32Loop = SYSCTL_RCGCGPIO_R;
    
        //
        // Enable the GPIO pin for the LED (PQ7).  Set the direction as output, and
        // enable the GPIO pin for digital function.
        //
        GPIO_PORTN_DIR_R = 0x01;
        GPIO_PORTN_DEN_R = 0x01;
    
        //
        // Loop forever.
        //
        while(1)
        {
            //
            // Turn on the LED.
            //
            GPIO_PORTN_DATA_R |= 0x01;
    
            //
            // Delay for a bit.
            //
            for(ui32Loop = 0; ui32Loop < 200000; ui32Loop++)
            {
            }
    
            //
            // Turn off the LED.
            //
            GPIO_PORTN_DATA_R &= ~(0x01);
    
            //
            // Delay for a bit.
            //
            for(ui32Loop = 0; ui32Loop < 200000; ui32Loop++)
            {
            }
        }
    }

    I know that the init on the pin N are wrong , but I don t know where to find  doc to correctly write teh systcl for Pin N

  • First I advise you to go check the driver source code. Check how they use direct register access through macros.
    You could also do your code in Tivaware and then check all the functions source.

    As I said the only thing you have for that is the datasheet (for the MCU). If you open in adobe reader (instead of in the web browser) there should be bookmarks on the left. Go to the GPIO and check the sub bookmarks of Initialization and register map.
    There is no easy way to do what you request. You will have to read a lot and kinda find out by yourself.

    You want to do something that the Tiva team discourages and that most users avoid. Yes I can most of the times use direct register program with the HWREG like macros but I rarely do that. I started with Tivaware first which will do for 90% of the cases and only later when some functions were missing or I wanted faster code that I went to the datasheet and/or source code of the libraries and accessed the registers.
    I personally don't think that the way you are going is not the best. There's really no point for you to know to do everything with register programming - yes that's great you spent hours to perfect that, well that other guy spent much less time doing the same with Tivaware - do you think it matters?
    You should know your MCU yes, but instead you should probably just try to learn the "holes" in Tivaware - for example, to edit a timer counter value (not load value) you need to use register access (if there is a function I never found it). + There's a lot of info on the peripherals on the datasheet that allows you to learn the possible features without going into registers and then go find the functions in the Tivaware guide.

    Just my opinion.
    Again, if you want to do register programming only, you better start reading that 1k-2k page datasheet...
  • Go to the datasheet and see 10.4 Initialization and Configuration, it should help you
  • Luis Afonso said:
    notice the MCU does not have a reference guide distinction from the MCU datasheet - the datasheet is the reference

    That's true here - but not of all MCU vendors - where a separation of MCU "basics" (shorter MCU datasheet) and "deep detail" (Reference Manual, 1K+ pages) exists.

    In combination - with both docs. open & "side by side" - understanding may be aided.   (our finding - over several years use)

    To aid efficiency here (one combined "reference & datasheet") we find that selective printing of key/critical register pages greatly reduces "paging" thru the thick doc. - which often breaks focus, prolongs the effort, and provides NO future (lingering) benefit.    (our selective print-out of key register data - and other items - is filed (along with key commentary & explanation) - for quick/eased reuse - by all at our firm)

    Beyond this "combined datasheet-reference" - is squinting at the hundreds of PWM registers - where a single, critical "command/control" bit's misue will doom you - really fun?    Or (really) instructive?   To do what?   

    Might such prove a misuse of user time - while the real value of "Problem Solving" thru the best use of vendor's rich & expansive "APIs" - (which proves daily - of critical importance to those offering tech jobs) is being bypassed?