cancel
Showing results for 
Search instead for 
Did you mean: 

WICED Smart Bluetooth

Anonymous
Not applicable

Hello everybody, As I mentioned before, I am new to this type of programming. I've mainly programmed arduino's which is a joke compared to this chip. I am having alot of difficulties in converting my arduino code to be used with broadcom chip. For the time being what I need to do is GPIO. at the press of a button, turn on an LED, simple enough right? we'll im stuck with not being able to turn on the LED or figure out if my pins are correct.

If anyone has some time and would like to run my through the basics of this devkit and chip I would really appreciate it. We can meet online via skype or something alike.

0 Likes
1 Solution
ArvindS_76
Employee

The GPIO output voltage levels are the same as your Vio supply voltage. You need to use a level shifter if you want to translate this to a different voltage.

> I want to turn on a 20mA 3V LED is it possible to change the value from 1.8V to 3V?

P26-P29 (on the SoC, P26-P28 on the 2073xS modules and 32 pin QFNs) can source or sink up to 16 mA. I would suggest sinking instead of sourcing, just to keep large currents from flowing through the chip and heating it.

> Also, I added my `gpio_configurePin` in the create() function, is that bad/good? that way when i call my function that turns on LED, I can just set the pin by using: `gpio_setPinOutput`

Sure, this is OK to do. Though you must remember that when you configure a pin and output enable it, the output level parameter will take effect immediately. So the GPIO will be driven high in your app create function above.

View solution in original post

11 Replies
Anonymous
Not applicable

Hello jareddlc,

Have you tried looking at the QSG?

WICED Smart™ Quick Start Guide (SDK 2.x and TAG3 Board)

Let me know if this helps.

JT

0 Likes
Anonymous
Not applicable

thanks j.t, I read that and I up and running. My questions were in particular to get going with GPIO, and later receiving text data from bluetooth. Currently I'm focused on learning the GPIO portion.

0 Likes
Anonymous
Not applicable

Hello jareddlc,

Lights...Music...Action!  You decide:

MidTerm Exam:

  1. Go to the pwm_tones SDK example

pastedImage_1.png
2.  Replace the attached file

3.  Tell me what you hear??

Send me back the explanation.

[HINT] - GPIO connected to Buzzer

Thanks JT

Anonymous
Not applicable

Thanks, I've already ran that example.  I'm taking portions of it to try to build my code. please see my code at: turq

So what i've done, is trying to use the built in button, to toggle an external LED. I've read the doc references for the functions and I dont quite understand the following:

gpio_configurePin((TURQUOISEBICUSPID_LED1_GPIO) / 16, (TURQUOISEBICUSPID_LED1_GPIO) % 16, GPIO_OUTPUT_ENABLE, 1);

gpio_setPinOutput((TURQUOISEBICUSPID_LED1_GPIO) / 16, (TURQUOISEBICUSPID_LED1_GPIO) % 16, 1);

  • what is the purpose of dividing by 16 and modulo of 16.
  • I couldnt find a reference to the flag 'GPIO_OUTPUT_ENABLE'

I dont have an Oscope to check if my pins are changing. I am using the diagram i posted for GPIO as my reference, which im now starting to think it is incorrect

I would like to add a timer in between to be able to wait 250ms, 1000ms, before proceeding to turn turn off led.

0 Likes
ArvindS_76
Employee

void turquoisebicuspid_blink_led1(void)

{

    ble_trace0("turquoisebicuspid_blink_led1()");

    bleprofile_LEDBlink(250, 250, 2);

    gpio_configurePin((TURQUOISEBICUSPID_LED1_GPIO) / 16, (TURQUOISEBICUSPID_LED1_GPIO) % 16, GPIO_OUTPUT_ENABLE, 1);

    gpio_setPinOutput((TURQUOISEBICUSPID_LED1_GPIO) / 16, (TURQUOISEBICUSPID_LED1_GPIO) % 16, 1);

}

The default LED setting is to use P14 (see GPIO_PIN_LED in platform.h). Can you confirm D3 is installed on your tag board (this should be between the eight dipswitches and the GPIO header)?

TURQUOISEBICUSPID_LED1_GPIO is defined as P26. What is this connected to? P26 is brought out to J8.4. You need a scope or a logic analyzer to see the signal (or hook up an LED to it).

> what is the purpose of dividing by 16 and modulo of 16.

All GPIO API operate on ports and pins. There are 40 GPIOs arranged in three ports in the SoC - Port 0, Port 1 and Port 2. Ports 1 and 2 have 16 pins each and Port 2 has 8. So P26 is port 1, pin 10.

> I couldnt find a reference to the flag 'GPIO_OUTPUT_ENABLE'

See <SDK>include/Drivers/gpiodriver.h

>I would like to add a timer in between to be able to wait 250ms, 1000ms, before proceeding to turn turn off led.

See:

void turquoisebicuspid_reg_timer()

{

}

This is where you have to register your timer callbacks. See hello_sensor.c for a sample:

bleprofile_regTimerCb(hello_sensor_fine_timeout, hello_sensor_timeout);
bleprofile_StartTimer();

and follow the callbacks.

Anonymous
Not applicable

Thank you, so helpful. Looks like I was correct, J8.4 same as my image posted here: GPIO Headers

In terms of D3, the LED does turn on with bleprofile_LEDBlink(250, 250, 2); I'll look into the gpiodriver.h. I briefly looked at the timer from that example, but didn't quiet understand. I'll give it a shot and post some of my code. Could I connect a multimeter and check to see if P26 is changing?

i'll try to see If the status if my P26 is changing, and will try to learn how to do a timer.

0 Likes
Anonymous
Not applicable

I haven't quiet dug into timers yet, but given from the info above:

bleprofile_regTimerCb(hello_sensor_fine_timeout, hello_sensor_timeout);

bleprofile_StartTimer();

This means these timers get called automatically every 1s and 12.5ms in their default state, correct? What would be the best way to do logic involving timing. For instance, I want to call a function that repeatedly turns on my LED every user define interval.

Would i have to do a check in fine_timeout to see whether the condition has been met? What i really want to do is be able to do something like:

timer(250, function* turnOn_led) or something of that nature, which allows me to control how often I'll turn on an LED. thx arvinds j.t

0 Likes
ArvindS_76
Employee

> This means these timers get called automatically every 1s and 12.5ms in their default state, correct?

Yes (assuming your BLE_PROFILE_CONFIG.fine_timer_interval is 12 (or 13  - it gets rounded to the closest 12.5mS interval).

> What would be the best way to do logic involving timing.

You need to run a state machine in your fine timer or app timer callback - something as simple as a counter should work.

Anonymous
Not applicable

How do i change the power value of pins? currently i get 1.8V and low on 059.2mV. I want to turn on a 20mA 3V LED is it possible to change the value from 1.8V to 3V?

Also, I added my `gpio_configurePin` in the create() function, is that bad/good? that way when i call my function that turns on LED, I can just set the pin by using: `gpio_setPinOutput`

void turquoisebicuspid_create(void)

{

     //...

     // TurquoiseBicuspid Startup

    gpio_configurePin(TURQUOISEBICUSPID_GPIO_LED_PORT, TURQUOISEBICUSPID_GPIO_LED_PIN, GPIO_OUTPUT_ENABLE, GPIO_PIN_OUTPUT_HIGH);

}

void turquoisebicuspid_blink_led1(void)

{

    ble_trace0("turquoisebicuspid_blink_led1()");

    bleprofile_LEDBlink(250, 250, 2);

    //gpio_configurePin(TURQUOISEBICUSPID_GPIO_LED_PORT, TURQUOISEBICUSPID_GPIO_LED_PIN, GPIO_OUTPUT_ENABLE, GPIO_PIN_OUTPUT_HIGH);

    gpio_setPinOutput(TURQUOISEBICUSPID_GPIO_LED_PORT, TURQUOISEBICUSPID_GPIO_LED_PIN, GPIO_PIN_OUTPUT_LOW);

}

0 Likes
ArvindS_76
Employee

The GPIO output voltage levels are the same as your Vio supply voltage. You need to use a level shifter if you want to translate this to a different voltage.

> I want to turn on a 20mA 3V LED is it possible to change the value from 1.8V to 3V?

P26-P29 (on the SoC, P26-P28 on the 2073xS modules and 32 pin QFNs) can source or sink up to 16 mA. I would suggest sinking instead of sourcing, just to keep large currents from flowing through the chip and heating it.

> Also, I added my `gpio_configurePin` in the create() function, is that bad/good? that way when i call my function that turns on LED, I can just set the pin by using: `gpio_setPinOutput`

Sure, this is OK to do. Though you must remember that when you configure a pin and output enable it, the output level parameter will take effect immediately. So the GPIO will be driven high in your app create function above.

View solution in original post

Anonymous
Not applicable

Thanks! I'll love into how to getting a 3V signal. I also need to figure how to power an RGB LED given that i've done it using analogWrite() and this feature isn't available with this chip.

0 Likes