Quantcast
Viewing all articles
Browse latest Browse all 116964

Forum Post: How to Switch on LED in CC2540 Keyfob attached to P0.6 and P0.7

Hi everybody,

I am working with the cc2540 mini Dev-Kit.
I want to turn ON LED connected to P0.6 for few seconds.
I'm usingsimpleBLEPeripheral example. Setup as on the picture below.
P0.7 is set to LOW (sort of GND)
I'm controlling P0.6 and setting it HIGH and few seconds later LOW

To control the keyfob I'm using dongle and BTool.

simpleBLEPeripheral has custom attributes FFF1, FFF2, FFF3, FFF4, FFF5

FFF1 can be read and written

If I write to FFF1 a byte in hex(e.g. 02). This calls simpleProfileChangeCB

which has code to turn ON/OFF the LED. See below

static void simpleProfileChangeCB( uint8 paramID )
{
  uint8 newValue;

  switch( paramID )
  {
    case SIMPLEPROFILE_CHAR1:
      SimpleProfile_GetParameter( SIMPLEPROFILE_CHAR1, &newValue );

      P0_6 = 1; // GPIO6 outputs 1
      for (uint32 i=0; i<800000; i++) asm("NOP"); // 1s  delay @ NOP=125ns
      P0_6 = 0; // P0_6 ^= 1;
      
      break;

    default:
      // should not reach here!
      break;
  }
}

Code works only once and I see LED going RED for 2 sec.

If I try to write something to that handle 0x0025 again I get "Invalid parameter" error. See screenshot belowImage may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.

Could somebody help with this error? Why I'm getting "Invalid parameter" error ?

I tried to use CC debugger but I cannot connect from dongle to keyfob if the debugger is active. Have somebody experienced the same problem?

Thanks.

Kind regards.

Sergey Lukin


Viewing all articles
Browse latest Browse all 116964

Trending Articles