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.

RTOS/CC1310: How to add simple PIN functionality to BIM example

Part Number: CC1310

Tool/software: TI-RTOS

Hi

I have started developing a bootloader for the CC1310, based on the CC1310 example:

  bim_extflash_cc1310lp

It compiles OK, and I have made some simple changes to support my appliacation.

Now i need to implement simple GPIO functionality, using "PIN_setOutputValue".

I have included 

#include <ti/drivers/PIN.h>
#include <ti/drivers/pin/PINCC26XX.h>

But the compiler does not recognize the "PIN_setOutputValue".

TI-RTOS documentation says:

To use the PIN driver ensure that the correct TI-RTOS driver library for your device is linked in and include this header file:

#include <ti/drivers/PIN.h>
PIN.h is included, but how do I link in the TI_RTOS ind the project?
My main application uses many of the TI-RTOS drivers. This application is based on another example, where I guess the TI-RTOS was already linked.
I have tried to go through all project settings for my main application that used the PIN.h, but I can't figure out what I should do to link the TI-RTOS with my BIM project.
Thanks!
Kaare
  • Hello,

    The best way to implement pin control in the BIM project is to use driverlib functions.
    These are independent from the RTOS and are readily available for you to use.

    dev.ti.com/.../group__gpio__api.html

    Regadrs,
    AB
  • Hi AB

    Thanks for quick response!

    I have always used the TI-RTOS, but the direct way as you mention, seems easy.

    But I get a weird problem in CCS, my IO init function, where I want to setup two pins for output:

    The application compiles fine. But i cant set breakpoints as expected, and I can't singlestep

    here is the small IO setup function I am playing with, including comments on breakpoints:

    bool extFlashOpen(void)
    {

      // Setup PWRKEY for output:

      IOCPinTypeGpioOutput( PWRKEY_PORT );                                                         Breakpoint possible, and application breaks here. But "Step over" halts the debugger

      GPIO_setOutputEnableDio( PWRKEY_PORT, GPIO_OUTPUT_ENABLE );        I can't set breakpoint here. Breakpoint is set on the last line (DTR setup)

      GPIO_writeDio( PWRKEY_PORT, 0 );                                                                   Same as above
      GPIO_writeDio( PWRKEY_PORT, 1 );                                                                   Same as above 
      GPIO_writeDio( PWRKEY_PORT, 0 );                                                                   Same as above

      // Setup DTR for output:

      IOCPinTypeGpioOutput( DTR_PORT );                                                                 I can set breakpoint here, but never reaches it.

  • Hi
    Any thoughts about my problem?
    I really can't figure out why the "GPIO_writeDio()" is "optimized out".
    It seems so simple, but I can't get it to work...

    "IOCPinTypeGpioOutput()" is OK.
    But the three calls to GPIO_writeDio() is not compiled:

    // Configure pin as standard digital output
    IOCPinTypeGpioOutput( PWRKEY_PORT );

    // Toggle the pin for test purpose:
    GPIO_writeDio( PWRKEY_PORT, 0 );
    GPIO_writeDio( PWRKEY_PORT, 1 );
    GPIO_writeDio( PWRKEY_PORT, 0 );

    Am I doing anything wrong?

    Thanks
    Kaare
  • Hi

    When I read the documentation, it should be possible to setup a pin for normal output, and then set/reset the pin with these two calls:

    IOCPinTypeGpioOutput()
    GPIO_writeDio()

    When I call IOCPinTypeGpioOutput(), the debugger simply stops.

    Must I do anything before this call?
    I have studied other simple PIN/GPIO examples, not using TI-RTOS. They cal Power_init(), but as I can find out, this is actually a TI-RTOS dependent call?
    Must I call other function(s) to power the GPIO ?

    I have tried "everything" now, but always ends up in a dead-end.

    I really hope you can help me, as I am totally stuck...

    br
    Kaare
  • Hi

    Please, can you help me, or should I ask elsewhere ?

    br
    Kaare
  • Hello,

    Sorry for the delay.

    /* GPIO power */
    PRCMPowerDomainOn(PRCM_DOMAIN_PERIPH | PRCM_DOMAIN_SERIAL);
    while (PRCMPowerDomainStatus(PRCM_DOMAIN_PERIPH | PRCM_DOMAIN_SERIAL)
    != PRCM_DOMAIN_POWER_ON);

    /* GPIO power */
    PRCMPeripheralRunEnable(PRCM_PERIPH_GPIO);
    PRCMLoadSet();
    while (!PRCMLoadGet());

    /* GPIO pin configuration */
    IOCPinTypeGpioOutput(IOID_7);

    /* SET the pin */
    GPIO_setDio(BSP_IOID_FLASH_CS);

    /*Clear the Pin*/
    GPIO_clearDio(BSP_IOID_FLASH_CS);

    Regards,
    AB
  • Thanks, but I found out the issue a couple of days ago:

    The BIM example calls bspSpiOpen(), which expected was setting up the SPI port.

    But it also sets up the GPIO power, so I could not understand why it did not work after commenting out the SPI source, which I don't need...

    Your help would have helped, anyway :)

    br

    Kaare