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.

Control CC2540 test pins by iPhone App

Other Parts Discussed in Thread: CC2540

Hi there,

I am using the Wireless Connectivity Dev. Kit with CC2540DK-Mini (http://www.ti.com/lit/ml/swru272a/swru272a.pdf) with the standard software ( CC2540 keyfob), witch was already include on the Dev. Kit.

My iPhone is a iPhone 5, iOS 7.1.

My Challenge now is to control the test pins on this Dev Kit Board the an iPhone App.

I know Pins

1 - P0.6

2 - P1.5

3 - P0.7

4 - P1.7

5 - P0.1

6 - P1.4

7 - P0.0

8 - P1.3

9 - not connected

10 - P1.2

I know also to use:

  1. P0SEL=0; -->set the pin as a General Purpose Input/Output
  2. P0DIR=0xFF; -->set the pin direction
  3. P0=0xFF; -->set all pins of port 0 to high

But I do I do it for iPhone or in Obejctiv-C. What is the meaning of SEL, DIR in Objectiv-C.

I really despair :((

Please help me.

Cheers

isicom

  • Hello isicom,

    The SEL defines if the pin is GPIO or a special function like an ADC or UART the DIR is for defining if the pin is an input or output.  These are all done in the firmware on the KeyFob.  If the pin is an input, then your app would read the value from it.  For an output, your app would write a value to it.  More precisely, it would read and write the characteristic value assigned to the pin.  Look at the techBasic App and website.  It will give you a much clearer explanation of exactly how the two devices communicate.

    Thanks,

  • Hey Greenja,

    thanks a lot for your post.

    I know the meaning of SEL, DIR and how to use it. What I want to know is, how do I set SEL and DIR in an iPhone App (Objectiv-C) is there any example to set the right addresses?

    Best Regards,

    isicom

  • Your options would be to download the iOS App from the wiki and go through the code to see how to read and write characteristic values to the CC2540.  You can also visit one of the Apple Objective-C forums and search for how they communicate with the CC2540.

    Once you know how to write code for using the BLE on the iOS, then inside the CC2540 firmware you would let PxSEL = the CharacteristicValue.