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.

Where to start

Other Parts Discussed in Thread: RM42L432, HALCOGEN

Hi


I recently ordered and received a few Hercules LaunchPad evaluation kits. I am an experienced C/C++ programmer with experience writing kernel-space code to control hardware under the Linux OS. My question is: How do I get started programming the Hercules board? I see a lot of documentation on the TI site but I don't know what I should be reading to get started.

Thanks

  • There is a technical reference manual (TRM) for each flavor of chip.  What are you using?  You should be able to find it on the TI site. 

    You can read up on the chip and the different aspects of it you want to use.  It really depends on what your end application is.

  • Hi David


    I am using the Hercules LaunchPad LaunchXL-RM42which uses the RM42L432 microcontroller. Is this the document you are referring to:

    http://www.ti.com/lit/ds/symlink/rm42l432.pdf

    In my project I will be using hardware interrupts generated by the timer/counter and hardware interrupts generated by one of the I/O pins. I will also be reading serial data sent to the Hercules LaunchPad by way of the UART on the board.


    Thank you

  • I would read through this:

    http://www.ti.com/lit/ug/spnu516a/spnu516a.pdf

    (Ok at 1000 pages I wouldn't read through it, but find the sections you want and get lots of detail there).

     

    Specifically you'll need RTI for your timer interrupts, GIO for your input, and SCI I believe for your UART.

     

    I'm assuming you've installed Halcogen, a lot of the set up you need to do is there.  They also have examples that will be helpful.  I think there is at least one on setting up RTI.  I haven't played with the SCI much, but setting up a timer using the RTI is not hard, neither is setting up GIO interrupts once you know what you are doing.

  • Thank you, David.

    Is the C/C++ API for writing to the needed registers etc explained in that document? If not then what should I read to learn about the C/C++ API for the Hercules LaunchPad microcontroller board?

  • I haven't used the Hercules Launchpad, but I assume it's just a development kit.  Also, I use the TMS series, not the RM48's, but they are pretty similar.

     

    You don't need any special API to write to registers. When you have generated halcogen code, it will provide .c / .h files for the drivers you specify.

     

    So for example in reg_spi.h  it will show something like

    typedef volatile struct spiBase
    {
        uint32  GCR0;                 /**< 0x0000: Global Control 0 */
        uint32  GCR1;                 /**< 0x0004: Global Control 1 */	
        uint32  INT0;                 /**< 0x0008: Interrupt Register */	
        uint32  LVL;                  /**< 0x000C: Interrupt Level */
        uint32  FLG;                  /**< 0x0010: Interrupt flags */		
        uint32  PC0;                  /**< 0x0014: Function Pin Enable */
        uint32  PC1;                  /**< 0x0018: Pin Direction */
        uint32  PC2;                  /**< 0x001C: Pin Input Latch */
        uint32  PC3;                  /**< 0x0020: Pin Output Latch */
        uint32  PC4;                  /**< 0x0024: Output Pin Set */
        uint32  PC5;                  /**< 0x0028: Output Pin Clr */
        uint32  PC6;                  /**< 0x002C: Open Drain Output Enable */
        uint32  PC7;                  /**< 0x0030: Pullup/Pulldown Disable */
        uint32  PC8;                  /**< 0x0034: Pullup/Pulldown Selection */
        uint32  DAT0;                 /**< 0x0038: Transmit Data */
        uint32  DAT1;                 /**< 0x003C: Transmit Data with Format and Chip Select */
        uint32  BUF;                  /**< 0x0040: Receive Buffer */
        uint32  EMU;                  /**< 0x0044: Emulation Receive Buffer */
        uint32  DELAY;                /**< 0x0048: Delays */
        uint32  DEF;                  /**< 0x004C: Default Chip Select */
        uint32  FMT0;                 /**< 0x0050: Data Format 0 */
        uint32  FMT1;                 /**< 0x0054: Data Format 1 */
        uint32  FMT2;                 /**< 0x0058: Data Format 2 */
        uint32  FMT3;                 /**< 0x005C: Data Format 3 */
        uint32  INTVECT0;             /**< 0x0060: Interrupt Vector 0 */
        uint32  INTVECT1;             /**< 0x0064: Interrupt Vector 1 */
        uint32  RESERVED[51U];        /**< 0x0068 to 0x0130: Reserved */	
        uint32  IOLPKTSTCR;           /**< 0x0134: IO loopback */
    } spiBASE_t;
    
    /** @def spiREG1
    *   @brief SPI1 (MIBSPI - Compatibility Mode) Register Frame Pointer
    *
    *   This pointer is used by the SPI driver to access the spi module registers.
    */
    #define spiREG1 ((spiBASE_t *)0xFFF7F400U)

    So if I want to write to the register PC4 for instance, I can just say

    spiREG1->PC4 = (uint32_t)1U << 4;

    The description of the registers is in the TRM.  All of the setup with the registers is done in Halcogen.  You can set up your RTI timer in halcogen for instance, then all you need to do is call

    rtiInit();
    rtiEnableNotification(notification);
    rtiStartCounter(counterBlock);


     

    And the counter will start running.   Then you add your code under the rti section in notification.c

  • David,

    Thank you very much for your excellent responses.

    Dan,

    HALCoGen is the tool you need to generate any C/C++ API functions. HALCoGen also allows you to define an initial state / configuration of many modules using a GUI. This configuration can be done by calling that module's "init" function, which abstracts you from having to write to each control register individually.

    You can also use the generated header files and write to the control registers directly, as David suggested.

    Regards, Sunil

  • Thanks Sunil

    I may end up using Halcogen but I would rather get to know programming of microcontrollers from a lower level first. In my experience high level programming always has a big down side. Can you help me by pointing me to documentation that describes the use of C/C++ for direct programming of the Hercules without using Halcogen?

    Dan

  • The technical reference manual gives you that.

     

    But I highly recommend using halcogen.  It still requires you to know the microcontroller and will aide as a learning tool.

  • Is there a Halcogen manual available?

  • Dan,

    I used the examples from the HALCoGen help menu (Help -> Help Menu -> examples) as a guide on how to use the tool,

    also the Project0 example (I know you reported that you have issues with that tutorial - it worked ok for me) and the videos posted by TI on youtube.