TMS320F28P559SJ-Q1: Writing directly to microcontrolle registers in the code

Part Number: TMS320F28P559SJ-Q1
Other Parts Discussed in Thread: C2000WARE, SYSCONFIG

Tool/software:

Hi, 

I am trying to work on a new Launch pad  and I have set up my code.  However, I could not write directly to the microcontroller register.  

I get this warning message below:

#10247-D: creating output section \"AdccRegsFile\" without a SECTIONS specification",

And the code has no effect.

How do i write directly to the microcontroler register without having to go through the device library.

Thanks

  • Hello,

    I would suggest taking a look at some of our example code in C2000ware. Depending on the style of project (bitfield or driverlib - see explanation here), there are different way to read/write registers directly.

    • Driverlib
      • The .c and .h files in the path:[C2000ware install]\driverlib\f28p55x\driverlib have examples of driverlib read/writes
      • Write example:  HWREGH(base + ECAP_O_ECCTL1) =
        (HWREGH(base + ECAP_O_ECCTL1) & ~(1U << shift)) |
        ((uint16_t)polarity << shift);
      • Read example: uint32_t  count = HWREG(base + ECAP_O_CAP1);
    • Bitfield
      • The .c and .h files in each of the folder in path: C2000ware install]\device_support\f28p55x\examples show examples of bitfield read/writes
      • Write example:  AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 1;
      • Read example:  adcAResults[index++] = AdcaResultRegs.ADCRESULT0;

    Best Regards,

    Delaney

  • Hello Delaney,

    Thanks for the reply.

    This is the way I implemented the direct write to the microcontroller register

    Write to registger line 

                    PieCtrlRegs.PIEACK.all = INTERRUPT_ACK_GROUP10;
    And I copied the f28p55x_globalvariabledefs.c into my project.
     
    I however still got that warning message.  
    I did not see any example for Bitfield type that you refered to your reply.  Can you refer me to a particular example.
    Thanks.
  • Hi Abayomi,

    It looks like you are using bitfield code then. I would suggest starting from one of the example projects in C2000ware or the empty project example (path:  C2000ware install]\device_support\f28p55x\examples) to start with. This will make sure all the include files are already being pulled in correctly. Then, you can make modifications to this project for your specific application.

    Best Regards,

    Delaney 

  • Hi Delaney,

    Thanks for your feed back.

    This above step was what I used at the commencement of my project.

    Does that mean that there is no example in the C2000ware folder?

    Thanks

  • I have seen an example now.  I would update you when its solved.  Thanks

  • Hi,  

    I have not been able to solve it as the examples that use Bitfield did not use sysconfig and the examples with sysconfig did not use Bitfield.  I am using sysconfig for my project.

    I think the problem relates to the linker command files mapping the register address to the microcontrollere itself.

    What else can I try out.  

    Thanks

  • Hi Abayomi,

    I see, I didn’t know you were using Sysconfig. In that case I would suggest using a driverlib style project for your development which has built in Sysconfig support. This is our most user-friendly software. Can you try running one of the examples in: [C2000ware install]\driverlib\f28p55x\examples ?

    Best Regards,

    Delaney

  • HI Delaney,

    Thanks for your reply.  Yes I am using sysconfig for my project.

    I would like to clarify "using a driverlib style project for your development"  in your reply.

    How do I modify my project for the above as my project is already generated?

    Secondly, can you point me to a particular example for this.

    Thanks.

    Best Regards,

    Yomi

  • Hi Yomi,

    How do I modify my project for the above as my project is already generated?

    By this do you mean the Sysconfig selections have already been done or you've already written your application code (in a bitfield format)?

    Best Regards,

    Delaney

  • HI, 

    I mean I have already done my Sysconfig selection and configuration.  I have also written the code that is meant to handle the ISR.

    Thanks

  • Hi Yomi,

    I see, in that case you can easily just copy over the contents of the .syscfg file into the .syscfg file in the new project using right click >> Open With >> Generic Text Editor. I would suggest doing the following:

    1. Import [C2000ware install]\driverlib\f28p55x\examples\empty_project
    2. Copy the contents of your .syscfg file into the c2000.syscfg file in the empty project
    3. Add an include for board.h in the main file and a call to Board_init() if this is not already in the empty project
    4. Copy over your ISR code and convert to driverlib format

    Best Regards,

    Delaney