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.

Pin configuration problem of Keyfob and USB dongle



Hi everyone,

I am trying to switch the program of Keyfob and USB dongle in EmulatedKeyboard project, I mean download the EmulatedKeyboard program to Dongle and HIDDemo to Keyfob, I notice that the pin configuration of this two hardware is different, so I change the config file: hal_board_cfg.h, do I have to change other files? and besides switches and leds, is there any other things I should take care of?

  • I changed hal_key.c .h and hal_led.c .h, and hal_board_cfg.h, seems led is working well, but the switch is not working, what else file I have to take care of?

  • Hi Xiaochuan,

    glad to know you are having progress but please try to keep your questions in a single thread. Please remove and / or verify one of them. tomorrow if you have doubts I'll try to do keyfob program tests in my work place ;)

  • Hi kazola,

    I verify theother one problem, still I could not make the dongle work. the following is the keyfob side hal_key.h original defination, I think I might have problem in this part, could you tell me how to change this part? the original port is SW1 P0_0 and SW2 P0_1, I want to change it to SW1 P1_2 and SW2 P1_3.

    /* SW_1 is at P0.0 */
    #define HAL_KEY_SW_1_PORT   P0
    #define HAL_KEY_SW_1_BIT    BV(0)
    #define HAL_KEY_SW_1_SEL    P0SEL
    #define HAL_KEY_SW_1_DIR    P0DIR

    /* SW_2 is at P0.1 */
    #define HAL_KEY_SW_2_PORT   P0
    #define HAL_KEY_SW_2_BIT    BV(1)
    #define HAL_KEY_SW_2_SEL    P0SEL
    #define HAL_KEY_SW_2_DIR    P0DIR

    #define HAL_KEY_SW_1_IEN      IEN1  /* CPU interrupt mask register */
    #define HAL_KEY_SW_1_ICTL     P0IEN /* Port Interrupt Control register */
    #define HAL_KEY_SW_1_ICTLBIT  BV(0) /* P0IEN - P0.0 enable/disable bit */
    #define HAL_KEY_SW_1_IENBIT   BV(5) /* Mask bit for all of Port_0 */
    #define HAL_KEY_SW_1_PXIFG    P0IFG /* Interrupt flag at source */
    #define HAL_KEY_SW_2_IEN      IEN1  /* CPU interrupt mask register */
    #define HAL_KEY_SW_2_ICTL     P0IEN /* Port Interrupt Control register */
    #define HAL_KEY_SW_2_ICTLBIT  BV(1) /* P0IEN - P0.1 enable/disable bit */
    #define HAL_KEY_SW_2_IENBIT   BV(5) /* Mask bit for all of Port_0 */
    #define HAL_KEY_SW_2_PXIFG    P0IFG /* Interrupt flag at source */

    #define HAL_KEY_SW_1_EDGEBIT  BV(0)

  • Ein?

    You can't! The buttons of the keyfob are soldered to the indicated input pins.

  • I mean change the configuration of software, make the software work.

  • Hi Xiaochuan,

    That would be something like this;

    /* SW_1 is at P1.2 */
    #define HAL_KEY_SW_1_PORT P1
    #define HAL_KEY_SW_1_BIT BV(2)
    #define HAL_KEY_SW_1_SEL P1SEL
    #define HAL_KEY_SW_1_DIR P1DIR

    /* SW_2 is at P1.3 */
    #define HAL_KEY_SW_2_PORT P1
    #define HAL_KEY_SW_2_BIT BV(3)
    #define HAL_KEY_SW_2_SEL P1SEL
    #define HAL_KEY_SW_2_DIR P1DIR

    #define HAL_KEY_SW_1_IEN IEN1 /* CPU interrupt mask register */
    #define HAL_KEY_SW_1_ICTL P1IEN /* Port Interrupt Control register */
    #define HAL_KEY_SW_1_ICTLBIT BV(2) /* P1IEN - P1.2 enable/disable bit */
    #define HAL_KEY_SW_1_IENBIT BV(4) /* Mask bit for all of Port_1 */
    #define HAL_KEY_SW_1_PXIFG P1IFG /* Interrupt flag at source */
    #define HAL_KEY_SW_2_IEN IEN1 /* CPU interrupt mask register */
    #define HAL_KEY_SW_2_ICTL P1IEN /* Port Interrupt Control register */
    #define HAL_KEY_SW_2_ICTLBIT BV(3) /* P1IEN - P1.3 enable/disable bit */
    #define HAL_KEY_SW_2_IENBIT BV(4) /* Mask bit for all of Port_0 */
    #define HAL_KEY_SW_2_PXIFG P1IFG /* Interrupt flag at source */

    #define HAL_KEY_SW_1_EDGEBIT BV(0)
    For more details, please have a look in the CC2540 User Guide found here, especially the "2.5 Interrupts" and the "7. I/O Ports" Chapters.
    Br
  • Hi Nick, Thank you for your answer, but still the switch is not working, could you tell me which related files I have to change to modify the pin configuration?

  • I use the packet sniffer read the advertisment package of the modifyed emulatedkeyboard program(download to another usbdongle), it turns out that it only send out one package, then stopped, what is the possable reason can cause that? The modified program is working well on keyfob, it keep doing advertisment until time out.