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.

CC2540 and Current drivers

Other Parts Discussed in Thread: CC2540

Hello all, just installed all of the software for programming the CC2540 but I can't seem to find the example code to control the two ports that have a 20mA current drive capability. Port 1.0 – 20-mA drive capability Port 1.1 – 20-mA drive capability .. My ultimate goal would be to get together some lines of code that would control the output of these current drivers to lets say output 8mA to an LED for a duration of time or 15mA for another command sent to the chip.

Can anyone point me in the right direction or show me how to do this?

  • These pins are just ordinary I/O pins with higher drive strength. They are described in Chapter 7 of the CC2540 User Guide (http://www.ti.com/litv/pdf/swru191b). In the BLE stack, you find some code using this in hal_led.c, but that is advanced code for blinking etc. The basic on/off code is found in macros defined in hal_board_cfg.h.

    From your question, it looks as if you want to control the current limit in those pins. That is not possible; these high-drive pins are designed for a LED that can be in two states, on or off. The output is a fixed voltage at VDD or GND which is relatively independent of the current drawn from the pin up to a current of 20 mA. In order to limit the current going into a LED connected to this pin, you need to add a series resistor. To have more advanced control, you will probably need a LED driver circuit of some sort.

    If you want the LED to have varying intensity, you can obtain that by duty cycling the output. You can use Timer 1 or Timer 4 to control P1.0 and P1.1, and then set the output to toggle with a given frequency and varying duty cycle. See Chapter 7, 9, and 10 of the User Guide for details. I am not sure if there exists any example code that does this.

  • So lets say I use one of the current driver pins and connect a resistor to it to control the output current, is there programming for creating a timer for the length of time that these output pins can output current and then shut off by sending a command from the master CC2540?