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.

CCS/CC2650MODA: Simple Ble Peripheral Digital Input Read+Send

Part Number: CC2650MODA

Tool/software: Code Composer Studio

Hi,

I m using CC2650MODA and finally i achieved to broadcast with it using Simple_peripheral example in ble-sdk plugin. I can send any value through bluetooth but when I try to send pin state information (high or low), I could not send it. I don't know the reason. 

PIN_Config radCtrlCfg[] =

{
IOID_13 | PIN_INPUT_EN | PIN_PULLUP, /* Pin Configuration

or

PIN_ID(13) | PIN_INPUT_EN | PIN_PULLUP, /* Pin Configuration

}

I tried both of below to get input value but it does not work.

value = value + PIN_getInputValue(PIN_ID(13);

value = value + PIN_getInputValue(IOID_13);

I also try to read register and expressions in CCS, but there is no expression as PIN_getInputValue but there is an expression PINCC26XX_getInputValue which is the expression in  PIN_getInputValue  function. But when i try to call PINCC26XX_getInputValue function, program could not be built.

What i want to do is to read input state H/L and send it through bluetooth. I try if function

if (PIN_getInputValue(PIN_ID(2)))

send 11;

else

send 22;

it does not work also.

 Could you help me how can i read the input state and send it through bluetooth?

Best regards,

Murat Kayhan

  • Hello Murat,
    Why do you write
    value = value + PIN_getInputValue(PIN_ID(13); and not
    value = PIN_getInputValue(PIN_ID(13);

    Did you make sure that no other peripheral are using IOID_13? Perhaps another driver opens it and disables the input buffer?
  • Hello Eirik,

    value = value + PIN_getInputValue(PIN_ID(13); is this argument wrong?

    There is not other peripheral using IOID_13. But when I debug the code and see IOC registers for P13, it was 0x00006000 and IE was not high. What can be the reason could not set IOC? I'm working on \simplelink\ble_sdk_2_02_02_25\examples\cc2650em\simple_peripheral example and what I want to do is to add button outside and send its H/L information through bluetooth.
    By using SimpleProfile_SetParameter(SIMPLEPROFILE_CHAR1, sizeof(uint8_t), &value), I'm sending information but I cannot send pin state. Could you please help me how can i read pin state with this example code? Since this code is in Simplelink BLE_SDK , i did not attach the code, but I hope you find me a way how I can read the pin state.

    Best regards,

    Murat Kayhan
  • Hello Murat,
    You can instead copy the button service implementation from project_zero (PZ). For BLE 2.1 this is a part of the standalone simplelink academy, while for our later parts PZ is a part of the SDK and can be found in TI Resource Explorer (http://dev.ti.com/tirex/#/).

    Donwload simplelink academy from here:
    software-dl.ti.com/.../overview.html
    Install and import the PZ project from here (installed folder):
    C:\ti\simplelink_academy_01_11_00_0000\modules\projects\ble_projectzero\

    Review the button_service files and review all the code related to these in project_zero.c:
    buttonPinTable
    buttonPinState
    buttonPinHandle

  • Hi Eirik,

    I look over the Project_Zero code quickly, Button_Service profile and its parts used in Project_Zero.c file. However, it is very complex to read a digital pin. Is there a simple method or register to read digital input? 

    Code will do this simply;

    Configure_PIN;

    OPEN_PIN;

    Read_PIN;

    Best regards,

    Murat Kayhan

  • Yes with PIN_getInputValue(), please refer to the PIN driver API:
    dev.ti.com/.../