1 Reply Latest reply on Nov 16, 2015 12:35 PM by userc_22273

    T/R switch/external PA on WICED WiFi dev boards

      Hi, I'm considering using the WiFi dev boards (the BCM943362WCD4 or BCM943341WCD1) for a product demo. I'm converting to a different frequency with an external PA, so I need to be able to access a T/R switch or PA control line to turn off the PA when not transmitting. Is there an easy hardware (a direct control pin) or software (using a GPIO for instance) option to do this? I'd really like to be able to use one of these modules, but not being able to control an external PA is a deal-breaker. Thanks for the help.

        • 1. Re: T/R switch/external PA on WICED WiFi dev boards

          Hi,

           

          So I have merged the gpio snip and the nfc snip to solve what you are trying to achieve.

          The application listens to NFC only when the SW1 is pressed on the board.

           

          For your reference the code is as follows:-

          You can just copy paste this in the nfc->tag_reader.c and see it work on the BCM943341 Board.

           

           

           

          #include "wiced.h"

          #include "wiced_nfc_api.h"

           

           

          /******************************************************

          *                      Macros

          ******************************************************/

           

           

          /******************************************************

          *                    Constants

          ******************************************************/

           

           

          #define NFC_DATA_LENGTH      ( 250 )

          #define NFC_READ_TIMEOUT      ( 10000 )

           

           

          /******************************************************

          *                  Enumerations

          ******************************************************/

           

           

          /******************************************************

          *                Type Definitions

          ******************************************************/

           

           

          /******************************************************

          *                    Structures

          ******************************************************/

           

           

          /******************************************************

          *              Function Declarations

          ******************************************************/

           

           

          /******************************************************

          *              Variables Definitions

          ******************************************************/

           

           

          wiced_nfc_workspace_t nfc_workspace;

           

           

          /******************************************************

          *              Function Definitions

          ******************************************************/

           

           

          void application_start( void )

          {

              int            i;

              wiced_result_t result;

              uint8_t        buffer[ NFC_DATA_LENGTH ];

              uint32_t      buffer_length;

              /* Note: NFC does not require Wi-Fi so we can use wiced_core_init() instead of wiced_init() */

              wiced_core_init( );

           

           

              WPRINT_APP_INFO( ("\nNFC tag reading application\n") );

           

           

              /* Initialize NFC.

              * Note: This can take up to 8 seconds to complete

              */

              WPRINT_APP_INFO(("\nInitializing NFC...\n"));

              if ( wiced_nfc_init( &nfc_workspace ) != WICED_SUCCESS )

              {

                  WPRINT_APP_INFO( ("NFC error\n") );

                  return;

              }

           

           

                wiced_bool_t led1 = WICED_FALSE;

                wiced_bool_t led2 = WICED_FALSE;

                wiced_bool_t button1_pressed;

                wiced_bool_t button2_pressed;

           

           

                /* Initialise the WICED device */

                wiced_init();

           

           

                WPRINT_APP_INFO( ( "The LEDs are flashing. Holding a button will force the corresponding LED on\n" ) );

           

           

                while ( 1 )

                {

           

           

                    /*Get the Time from NTP*/

           

           

           

           

                    /* Read the state of Button 1 */

                    button1_pressed = wiced_gpio_input_get( WICED_BUTTON1 ) ? WICED_FALSE : WICED_TRUE;  /* The button has inverse logic */

           

           

                    if ( button1_pressed == WICED_TRUE )

                    {  /* Turn LED1 on */

                        printf("Button Pressed");

                        wiced_gpio_output_high( WICED_LED1 );

           

           

           

           

                        WPRINT_APP_INFO( ("\nWaiting for tag...\n") );

           

           

                        /* Reset the buffer_length variable. Note that this is used for both input and output */

                        buffer_length = NFC_DATA_LENGTH;

           

           

                        /* Wait for, and read, and NFC tag */

                        result = wiced_nfc_read_tag( buffer, &buffer_length, NFC_READ_TIMEOUT );

                        if ( result != WICED_SUCCESS )

                        {

                            if ( result == WICED_TIMEOUT )

                            {

                                WPRINT_APP_INFO( ( "Tag not detected\n" ) );

                            }

                            continue;

                        }

           

           

                        WPRINT_APP_INFO( ( "Received %lu bytes:\n", buffer_length ) );

           

           

                        /* Print the contents of the NFC tag */

                        for ( i = 0; i < buffer_length; i++ )

                        {

                            /* Check if the character is printable, otherwise use hex notation*/

                            if ( buffer[ i ] >= 0x20 && buffer[ i ] <= 0x7E )

                            {

                                WPRINT_APP_INFO( ( "%c", buffer[i] ) );

                            }

                            else

                            {

                                WPRINT_APP_INFO( ( "\\%02x", buffer[i] ) );

                            }

                        }

                        WPRINT_APP_INFO( ( "\n" ) );

                    }

                    else

                    {  /* Toggle LED1 */

                        if ( led1 == WICED_TRUE )

                        {

                            wiced_gpio_output_low( WICED_LED1 );

                            led1 = WICED_FALSE;

                        }

                        else

                        {

                            wiced_gpio_output_high( WICED_LED1 );

                            led1 = WICED_TRUE;

                        }

                    }

           

           

                    /* Read the state of Button 2 */

                    button2_pressed = wiced_gpio_input_get( WICED_BUTTON2 ) ? WICED_FALSE : WICED_TRUE;  /* The button has inverse logic */

           

           

                    if ( button2_pressed == WICED_TRUE )

                    {  /* Turn LED2 on */

                        wiced_gpio_output_high( WICED_LED2 );

                    }

                    else

                    {  /* Toggle LED2 */

                        if ( led2 == WICED_TRUE )

                        {

                            wiced_gpio_output_low( WICED_LED2 );

                            led2 = WICED_FALSE;

                        }

                        else

                        {

                            wiced_gpio_output_high( WICED_LED2 );

                            led2 = WICED_TRUE;

                        }

                    }

           

           

                    wiced_rtos_delay_milliseconds( 250 );

                }

           

           

              while ( 1 )

              {

                  /**/

           

           

          /**/

           

           

              }

          }

           

          You may want to remove parts that are not required. For instance flashing leds.

           

          Hope that helps.

           

          Best Regards,
          AB