Skip navigation
Home > All Places > WICED Studio Wi-Fi/Combo > WICED Studio Wi-Fi/Combo Forums > Blog
1 2 3 Previous Next

WICED Studio Wi-Fi/Combo Forums

105 posts
grsr

STM32F469 porting in WICED

Posted by grsr Oct 10, 2018

Scope

 

The purpose of this document is to enable the WICED community to support a new MCU device using existing WICED Wi-Fi Driver (WWD) supported in WICED Studio. It allows user to use the MCU of their choice to achieve required system performance and cost goals. Though this document describes how to use a different MCU, Cypress community provides support only on the platforms/MCUs that are officially supported in WICED Studio. To learn more about the platforms/MCUs supported in WICED Studio, please refer to the WICED Studio Technical Brief. If you need support while porting to a different MCU, we recommend you to reach out to our partners.

 

This document covers the porting instructions with an example of Cypress’s Wi-Fi and Bluetooth combo device CYW4343W and ST MCU STM32F469.  Example leverages STM32F469-DISCO board as it has an SD card interface that makes it easy to access SDIO lines.

 

 

Disclaimer

 

This document assumes that you have basic understanding of WICED Studio and WICED Software Stack. The following document is a set of instructions / guidelines, which could vary based on the MCU chosen. The resultant platform files have not gone through the standard validation or testing done on platforms which are part of standard WICED Studio release.

 

 

Modifications required in WICED Studio

 

Steps involved in supporting a new MCU update existing files available in WICED that are used for other MCUs/Platforms.

 

1. Creating your own platform directory

The platform folder “CYW94343WWCD3” is placed in 43xxx_Wi-Fi/platforms as shown in Figure 1.

 

 

Figure 1 Platform directory

CYW94343WWCD3 folder.jpg

It would contain the files necessary to access the host processor peripherals, their configuration, Wi-Fi NVRAM settings, platform makefile.

 

a. platform.h: Declaration of GPIOs, LEDs, peripherals and corresponding IRQs are provided here. It is a good practice to first create a platform pin definitions table in platform.h. This table would map the WICED pin name to the exact pin name of the STM32 host processor. It is basically provided in commented form. For instance, the WICED pin name WICED_GPIO_1 is mapped to STM32 port pin G10 as shown in Figure 2.

 

Figure 2 Platform pin definitions

CYW4343WWCD3 platform pin definitions image.jpg

This will help us determine the total number of WICED pins which in turn would help us to define the enum wiced_gpio_t. This enum basically contains the list of WICED pin names which would be mapped to STM32 port pins in platform.c. Likewise peripheral pins such as SPI, I2C, UART are defined using the enums wiced_spi_t, wiced_i2c_t, wiced_uart_t. The total pins to be defined must be known before defining an enum.

 

To allow UART terminal printing, we would need to assign the STDIO_UART used for UART standard I/O to the appropriate WICED UART pin defined above.

 

b. platform.c: source file describing the GPIO organization which includes the Wi-Fi control pins, strapping options, essential peripherals like debug UART initialization. Customer also needs to be careful about defining the structures specific to their peripheral requirement. They can refer to the expected structure format in existing WICED supported platforms; e.g for STM32F4xx host MCU: 43xxx_Wi-Fi/WICED/platform/MCU/STM32F4xx/peripherals/platform_mcu_peripheral.h. This structure format is also dependent on the host MCU and peripheral choice.

 

This is where we define the mapping of WICED pin names to the corresponding STM32 port pins as shown in Figure 3.

 

Figure 3 GPIO pin table

GPIO pin table.jpg

Similarly, the Wi-Fi control pins and Wi-Fi SDIO pins are as shown in Figure 4

 

Figure 4 Wi-Fi control pins and SDIO pins

Wi-Fi control pins and SDIO pins.jpg

It is important to note that the WWD enums shown above have already been defined in the WWD driver and they are used during Wi-Fi initialization.

Next the WICED peripheral structure would need to be defined so that it captures all the information required for its initialization and subsequent operation. This would typically include the WICED pin names defined earlier, peripheral driver constants, register flags. The peripheral driver library is specific to a host processor, in this case, it is available in stm32f4xx.h. For instance, a typical UART peripheral is defined in Figure 5 for STM32F4XX.

Figure 5 UART peripheral configuration

UART peripherals and runtime drivers.jpg

As shown above, the WICED pin name WICED_UART_1 is defined above. The UART tx and rx pins have been mapped to the appropriate WICED GPIO pins defined earlier. The UART port is mapped to USART3 which is defined in stm32f4xx.h as a register address. The DMA configuration shown above was found from the TRM of STM32F469.

The hardware connections should be strictly made as per the mapping defined above.

The external devices such as LED, buttons, STDIO UART need to be initialized using the function platform_init_external_devices(). This function is called during MCU initialization.

The interrupt handler for a peripheral is defined using WWD_RTOS_DEFINE_ISR() and mapped to ISR using WWD_RTOS_MAP_ISR().

 

c. wifi_nvram_image.h: This is the nvram file for the WLAN module. This is supplied by the module partner. Since we are using the same Murata module used in NEB1DX_01platform, the nvram file can be interchangeably used.

 

d. platform_config.h: Clock configuration for the host MCU is provided here. For the host processor, the CPU clock frequency (CPU_CLOCK_HZ), crystal source (HSE_SOURCE), system clock divider constants (AHB_CLOCK_DIVIDER, APB1_CLOCK_DIVIDER, APB2_CLOCK_DIVIDER), PLL constants (PLL_SOURCE, PLL_M_CONSTANT, PLL_N_CONSTANT, PLL_P_CONSTANT, PLL_Q_CONSTANT, PLL_R_CONSTANT), system clock source (SYSTEM_CLOCK_SOURCE), systick clock source (SYSTICK_CLOCK_SOURCE), internal flash constants (INT_FLASH_WAIT_STATE, PLATFORM_STM32_VOLTAGE_2V7_TO_3V6), watchdog (DBG_WATCHDOG_TIMEOUT_MULTIPLIER) are used for configuring the host STM32F469. For the STM32F469 MCU, STM32CubeMX (https://www.st.com/en/development-tools/stm32cubemx.htmlSTM32CubeMX - STM32Cube initialization code generator - STMicroelectronics ) software was used. Using the STM32CubeMX tool, customers can select the target host MCU and the peripherals required for their use-case. The interactive tool also provides the option to correctly configure the clock based on the clock configuration in STM32CubeMX. The macros for Wi-Fi options WICED_WIFI_USE_GPIO_FOR_BOOTSTRAP_1, WICED_WIFI_OOB_IRQ_GPIO_PIN, WICED_USE_WIFI_POWER_PIN, WICED_USE_WIFI_32K_CLOCK_MCO and WICED_USE_WIFI_POWER_PIN_ACTIVE_HIGH need to be correctly defined as they would be used during WICED initialization. Please make sure to remove or comment out USES_RESOURCE_FILESYSTEM macro as we are putting all the resources in internal flash.

 

e. <platform_name>.mk: This is the platform makefile which contains information on the WLAN chip and host processor as well as Wi-Fi bus interface used which is SDIO for this module. Since the internal flash is enough to accommodate both Wi-Fi FW and clm blob, we have treated the memory resources as DIRECT RESOURCES (RESOURCES_LOCATION?= RESOURCES_IN_DIRECT_RESOURCES) which will build the WLAN FW and CLM blob along with the main application and put it in internal flash. The HSE_VALUE is the external crystal frequency used for clocking the host processor which is 8 MHz.

 

Creating these platform files require thorough knowledge of the host MCU. It is strongly advised to go through the datasheet and Technical Reference Manual (TRM) of the host MCU first.

 

We have interfaced the STM32F469 MCU to the Murata Type1DX through SDIO interface for which platform files should provide the correct pin mapping. To ease up the debugging, one UART port was used for which the DMA configuration, correct clock configuration, crystal selection, PLL settings need to be taken care of in platform files.

 

Essential points:

 

a. Wi-Fi control pins: These pins are used during initialization of WICED (43xxx_Wi-Fi/WICED/platform/MCU/wwd_platform_separate_mcu.c); hence the created platform file(s) should mention these pins.

 

b. Wi-Fi SDIO bus pins: For 4-bit SDIO transfer, data transfer lines (D0-D3), SDIO_CMD, SDIO_CLK along with the provision for OOB_IRQ should be provided in the platform definition. (43xxx_Wi-Fi/WICED/platform/MCU/STM32F4xx/WWD/wwd_SDIO.c).

 

Points to Check:

 

If the UART port is not working as expected, check the HW pins, PLL settings, crystal selection made in platform.config.h. To understand the clock organization better, the user can check-out 43xxx_Wi-Fi/WICED/platform/MCU/STM32F4xx/peripherals/libraries/system_stm32f4xx.c.

 

2. Creating the Memory map

The memory map for the host MCU can be generally found in 43xxx_Wi-Fi/WICED/platform/MCU/STM32F4xx/GCC as shown in Figure 6.

 

Figure 6 Memory map STM32F469

Memory map STM32F469.jpg

The user can create their own linker-script based on the memory organization of the host MCU. (STM32CubeMx software can be used to check the memory organization, but proper modification to the linker script is up-to user’s competence).

 

3. Modifying the common platform structure

 

The user must add the number of UART ports, number of SPI ports (if used) etc. for the target platform in 43xxx_Wi-Fi/WICED/platform/MCU/STM32F4xx/peripherals/platform_mcu_peripheral.h.

 

The number of flash sectors for the host MCU need to be specified separately as well in 43xxx_Wi-Fi/WICED/platform/MCU/STM32F4xx/WAF directory. The macro PLATFORM_APP_END_SECTOR needs to be defined because it would be used during the process of loading a new program and DCT into internal flash. For STM32F469, the macro was defined as per the information specified in the TRM.

 

As the source files for STM32F4xx series is already present in WICED Studio, we have enabled the platform_name macro (STM32F469_479xx) in 43xxx_Wi-Fi/WICED/platform/MCU/STM32F4xx/peripherals/libraries/stm32f4xx.h.

 

TP1: At this point, the compilation with WICED build system should pass for the created platform. The build statement should be snip.<test_basic>-<platform_name>

 

4. Adding the SDIO interface

 

If the compilation is successful, you can build and download scan application using snip.scan-CYW94343WWCD3 download run. We did not use download_apps in the build statement because we have placed our resources including WLAN firmware and CLM blob in internal flash memory. If you have used ST-Link, you can refer to the post Adding ST-Link support in WICED to enable ST-Link support in WICED. After the programming is successful, you can check the UART terminal output. If the terminal does not print the WLAN MAC address, WLAN firmware and WLAN CLM details, it means that WLAN interface was not initialised. A typical scenario is as shown in Figure 7.

 

Figure 7 WLAN interface not working

Stuck at creating packet pools.jpg

Check where the execution is getting stuck. You can enable the macro WPRINT_ENABLE_WWD_DEBUG to enable WWD debug prints. If SDIO bus does not initialize (check comment in WWD), make sure WL_REG_ON pin on the Murata module is connected to the pin defined by the index WWD_PIN_POWER in platform.c. Check SDIO clock control register for further debugging. Use SLOW_SDIO_CLK and SDIO_1_BIT in <platform_name>.mk file. 

 

If it is stuck at waiting on HT clock, the LPO has not been configured correctly. The LPO_IN pin needs to be connected to external source defined by the index WWD_PIN_32K_CLK defined in platform.c.

 

If you are getting stuck in F2, FIFO underflow could be a probable cause. Check the SDIO_STA (interrupt status) register to debug the issue. You can check wwd_sdio.c and wwd_bus_protocol.c. You can consider disabling the interrupt received flag SDIO_MASK_SDIOITIE from the SDIO mask register in STM32F4xx/WWD/wwd_sdio.c. In that case, the function wwd_bus_packet_available_to_read() would have to be commented out because this function would check for interrupt by reading the IntStatus register of the WLAN chip.

 

The patch file “WWD_changes.patch” contains the specific changes made to WWD driver discussed above which can be applied.

 

 

Test & Debug

 

a. Debugging and testing the SDIO interface

The WWD contains debug prints to indicate error or failure in function execution inside WWD. To enable WWD debugging, go to wiced_defaults.h and enable the following macros:

 

#define WPRINT_ENABLE_WWD_INFO         /* Wiced Wi-Fi Driver prints */

#define WPRINT_ENABLE_WWD_DEBUG

#define WPRINT_ENABLE_WWD_ERROR

 

Whenever the host processor needs to initialize or access the WLAN interface, it uses the SDIO interface and SDIO packets are transmitted/received across the interface. It is possible to evaluate the WWD and SDIO bus TX/RX statistics at any WWD function call to understand if there were any issues in the WWD and SDIO bus transactions. It basically provides us two types of statistics:

 

WWD Stats: This is encapsulated in the structure wwd_stats_t and it captures the TX/RX stats at WWD driver.

 

typedef struct

{

uint32_t tx_total;      /* Total number of TX packets sent from WWD */

uint32_t rx_total;      /* Total number of RX packets received at WWD */

uint32_t tx_no_mem;     /* Number of times WWD could not send due to no buffer */

uint32_t rx_no_mem;     /* Number of times WWD could not receive due to no buffer */

uint32_t tx_fail;       /* Number of times TX packet failed */

uint32_t no_credit;     /* Number of times WWD could not send due to no credit */

uint32_t flow_control;  /* Number of times WWD Flow control is enabled */

} wwd_stats_t;

 

Bus stats: This is encapsulated in the structure wwd_bus_stats_t and it contains information on SDIO TX/RX packet stats at the interface.

 

typedef struct

{

uint32_t cmd52;             /* Number of cmd52 reads/writes issued */

uint32_t cmd53_read;        /* Number of cmd53 reads */

uint32_t cmd53_write;       /* Number of cmd53 writes */

uint32_t cmd52_fail;        /* Number of cmd52 read/write fails */

uint32_t cmd53_read_fail;   /* Number of cmd53 read fails */

uint32_t cmd53_write_fail;  /* Number of cmd53 write fails */

uint32_t oob_intrs;         /* Number of OOB interrupts generated by wlan chip */

uint32_t sdio_intrs;        /* Number of SDIO interrupts generated by wlan chip */

uint32_t error_intrs;       /* Number of SDIO error interrupts generated by wlan chip */

uint32_t read_aborts;       /* Number of times read aborts are called */

} wwd_bus_stats_t;

 

The function wwd_print_stats ( wiced_bool_t reset_after_print ) evaluates the WWD packet stats and SDIO bus stats at the interface. To enable this function, enable the macro WWD_ENABLE_STATS in wiced_defaults.h. As an example, the wwd_print_stats(WICED_FALSE) is called inside SDIO/wwd_bus_protocol.c after WLAN firmware download wwd_bus_sdio_download_firmware( ) and before waiting for F2 to be ready.

 

Figure 8 Testing WWD stats

testing WWD stats.jpg

The results are shown below:

 

Working interface

 

WWD Stats..

tx_total:0, rx_total:0, tx_no_mem:0, rx_no_mem:0

tx_fail:0, no_credit:0, flow_control:0

Bus Stats..

cmd52:151, cmd53_read:0, cmd53_write:29

cmd52_fail:0, cmd53_read_fail:0, cmd53_write_fail:0

oob_intrs:0, sdio_intrs:151, error_intrs:0, read_aborts:0

 

Non-working interface

WWD Stats..

tx_total:0, rx_total:0, tx_no_mem:0, rx_no_mem:0

tx_fail:0, no_credit:0, flow_control:0

Bus Stats..

cmd52:151, cmd53_read:0, cmd53_write:29

cmd52_fail:0, cmd53_read_fail:0, cmd53_write_fail:0

oob_intrs:0, sdio_intrs:30, error_intrs:0, read_aborts:0

 

We can see that in a non-working interface, the number of sdio_intrs is far less than those in a working interface. So basically, the WWD packet stats would help us in characterizing the SDIO interface.

 

b. Testing i-perf statistics

To test the network performance of the added platform, a basic i-perf throughput test was done in normal environment between the WICED platform and a WIN 10 PC. The WIN 10 PC was set up as TCP server and the test.iperf_app was used to set up a TCP client in the WICED side (WICED board TX and PC is the RX here).

 

PC Side:

 

Run the command prompt in the i-perf directory and use the following command

 

iperf -s -w 655k

 

WICED Setup:

Build and download the test.iperf_app with the following packet pools settings in the iperf_app.mk

 

GLOBAL_DEFINES := TX_PACKET_POOL_SIZE=200 RX_PACKET_POOL_SIZE=200

GLOBAL_DEFINES += PBUF_POOL_TX_SIZE=100 PBUF_POOL_RX_SIZE=100

GLOBAL_DEFINES := WICED_TCP_WINDOW_SIZE=65535

 

iperf -c <ip_address of server> -w 655k

 

The throughput number we achieved for TCP client-server architecture is 5.66 Mbits/sec as shown in Figure 9.

 

Figure 9 I-Perf throughput

The help article for iperf set-up in WICED platform can be found at 43xxx_Wi-Fi/apps/test/iperf_app/README-Iperf.pdf.

 

General bringup issues

 

HT Avail Timeout

  • Caused due to wrong nvram.txt or the firmware.
  • Check the firmware matches the chip revision.
  • Check the LPO_IN connection.

 

Interrupt's not working/IOCTL timeout

  • Disable OOB and try with in band interrupt first.
  • For OOB, make sure that the GPIO number is provided correctly

 

Throughput Issues

 

  • Check whether we have enough bus level throughput.
  • Check whether the connection is made with proper capability. [11ac, 11n..80MHz, 40MHz etc]
  • Open air congestion might be a problem. Try it in a RF chamber.
  • Check the operating rate [wl rate].
  • Check the rssi value to see whether Antenna is proper [wl rssi].
rroy

Adding ST-Link support in WICED

Posted by rroy Oct 10, 2018

Scope

This blog provides a guideline to add support ST-Link (ST Micro’s programming & debug hardware) in an existing WICED SDK framework.

 

Disclaimer

Consider this document as a guideline, which has not been extensively tested and the procedure mentioned below could differ for different versions of WICED Studio & ST-Link.

 

 

Introduction

ST-Link is the on-board programmer used to program the code in ST MCU, details of which can be found at ST website. WICED uses OpenOCD to download the programs to the target MCU (ST host MCU, CYW43907, PSoC 6). In most of the standard WICED EVBs, an FTDI chip (FT2232H) has been used to provide the USB-UART  / USB-JTAG bridge functionality which is what has been the standard download procedure followed by the OpenOCD in WICED.

 

 

 

Brief Introduction about OpenOCD

Open On-Chip Debugger (OpenOCD) is a free open-source project that facilitates downloading, debugging by using a debug adapter like ST-Link, FT2232H etc. OpenOCD works either by using commands or by using configuration files. When configuration is done and a connection to the target is established, OpenOCD will start running as a daemon in the background. The OpenOCD directory file has a folder called “scripts”. In this folder, you will see "interface", "board", and "target" folders. These are pretty much the only folders you need.

  • Interface: Configuration files for hardware adapters, for example “stlink-v2-1.cfg”.
  • Board: Configuration files for common development boards like “stm32f469discovery.cfg” .. etc. You can see that these files reuse configuration files from interface and target.
  • Target: Configuration files for MCU Chips.

For detailed understanding of OpenOCD procedure and syntax, one can find their documentation at http://openocd.org/doc/html/index.html

 

 

 

WICED Download and debug procedure:

  In WICED, an OpenOCD command is put into the .gdbinit file by the makefile system during compilation.
Wiced Eclipse has an optional component "GDB Hardware Debugging" installed.  This allows it to instruct GDB to access a "GDB remote protocol server" via TCP.
Hence when Eclipse starts a debug session, it starts GDB, which in turn causes the .gdbinit OpenOCD command to be executed. OpenOCD is a "GDB remote protocol server", and next, Eclipse instructs GDB to connect to it.
During the startup of OpenOCD, it uses various JTAG & ARM protocols to interrogate the target chip. Once this initial interrogation is done, OpenOCD receives requests over TCP from GDB and services those requests on the target chip as needed details about this remote GDB can be found at GDB documentation.

 

 

How to add support for ST-Link:

WICED Environment uses the makefiles, configuration files as located in 43xxx_Wi-Fi/tools/makefiles and 43xxx_Wi-Fi/tools/OpenOCD respectively to download the code to the target MCU. Some changes have been made in the makefiles responsible for the download process and rest of the modifications were done in the OpenOCD directory, details of which can be found in the attached. Please note that modifying the existing makefiles, OpenOCD directory to enable ST-Link support is a one-way approach; i.e, you can’t program the other WICED boards (using a FT2232H chip) normally without restoring both directories back to the one shipped with SDK. So, it’s always recommended to make a back-up of the directories before replacing them with the attached.

                                                                       

In the example implementation, a custom JTAG macro was defined in the platform makefile (platform.mk) in the following way.

 

 

 

Based on the custom JTAG macro, openocd binary (openocd-all-brcm-libftdi.exe), as located in 43xxx_Wi-Fi/tools/OpenOCD/Win32/openocd-all-brcm-libftdi.exe expects a <custom JTAG macro>.cfg file in the 43xxx_Wi-Fi/tools/OpenOCD directory as shown in the figure below.

In this case, the stm32f469discovery.cfg file was copied from 43xxx_Wi-Fi/tools/OpenOCD/scripts/board/stm32f469discovery.cfg directory to the 43xxx_Wi-Fi/tools/OpenOCD directory. This stm32f469discovery.cfg has all the necessary interface, transport, target, reset_config specified. For a created platform, customer needs to create their own .cfg file based on the JTAG macro chosen and place them in 43xxx_Wi-Fi/tools/OpenOCD directory. If the created .cfg file has some error, a good place to start the debug procedure would be the openocd log generated as part of the build system which can be found at 43xxx_Wi-Fi/build/openocd_log.txt.

 

Refer to the files attached to this blog. We suggest you do a ‘Diff’ of the existing WICED Studio files and the attached files to understand the changes.

    SUMMARY:

    We shared four ways to set wifi mac address,  this blog is to show the process .

    Test is based on CYW954907AEVAL1F .

 

  • DCT  mode:
  1. Add define in app.mk: GLOBAL_DEFINES     += MAC_ADDRESS_SET_BY_HOST
  2. 43xxx_Wi-Fi\generated_mac_address.txt

     Modify the address in the directory , it works.

     #define NVRAM_GENERATED_MAC_ADDRESS "macaddr=00:A0:50:38:f6:35"

     #define DCT_GENERATED_MAC_ADDRESS "\x00\xA0\x50\xe8\xf3\x48"

     #define DCT_GENERATED_ETHERNET_MAC_ADDRESS "\x00\xA0\x50\xe5\xf3\x47"

 

  • OTP mode
  1. Disable //GLOBAL_DEFINES     += MAC_ADDRESS_SET_BY_HOST
  2. Need to clean the building, then make again.

 

    Starting WICED vWiced_006.002.001.0002

    Platform CYW954907AEVAL1F initialised

    Started ThreadX v5.8

    Initialising NetX_Duo v5.10_sp3

    Creating Packet pools

     WLAN MAC Address : B8:D7:AF:4D:1D:D6

     WLAN Firmware    : wl0: May 15 2018 19:39:17 version 7.15.168.114 (r689934) FWID 01-d6f88905

     WLAN CLM         : API: 12.2 Data: 9.10.74 Compiler: 1.31.3 ClmImport: 1.36.3 Creation: 2018-05-15 19:33:15

 

  1. Let us to go to MFG mode to check the OTP area.

        Have a test with mfg mode:

       test.mfg_test-CYW954907AEVAL1F download download_apps run

  • Modify it in NVRAM:
  • 43xxx_Wi-Fi\platforms\CYW954907AEVAL1F\board_revision\P101

     static const char wifi_nvram_image[] =

      "sromrev=11" "\x00"

      "vendid=0x14e4"                                                      "\x00"

      "devid=0x43d0" "\x00"

      "macaddr=00:A0:50:38:f6:35" "\x00"

 

  1. Disable //GLOBAL_DEFINES     += MAC_ADDRESS_SET_BY_HOST
  2. Do nothing, clean and build again.
  3. The mac address still is WLAN MAC Address : B8:D7:AF:4D:1D:D6

I do not find anywhere to fix the MAC address into nvram setting, so I presume OTP priority is higher than NVRAM,  if OTP existed the NVRAM mac address will be ignored .

 

 

  • CUSTOM MODE:
  1. Enable the define in app makefile: GLOBAL_DEFINES     += MAC_ADDRESS_SET_BY_HOST
  2. Modify the code, add simple test:
  3. 43xxx_Wi-Fi\WICED\platform\MCU\BCM4390x\

    4. bcm4390x_platform.c

wwd_result_t host_platform_get_mac_address( wiced_mac_t* mac )

{

#ifndef WICED_DISABLE_BOOTLOADER

    wiced_mac_t* temp_mac;

    wiced_result_t result;

    result = wiced_dct_read_lock( (void**)&temp_mac, WICED_FALSE, DCT_WIFI_CONFIG_SECTION, OFFSETOF(platform_dct_wifi_config_t, mac_address), sizeof(mac->octet) );

    if ( result != WICED_SUCCESS )

    {

        return (wwd_result_t) result;

    }

    memcpy( mac->octet, temp_mac, sizeof(mac->octet) );

       mac->octet[0]= 0x00;

       mac->octet[1]= 0x11;

       mac->octet[2]= 0x22;

       mac->octet[3]= 0x33;

       mac->octet[4]= 0x44;

       mac->octet[5]= 0x55;

    wiced_dct_read_unlock( temp_mac, WICED_FALSE );

#else

UNUSED_PARAMETER( mac );

#endif

    return WWD_SUCCESS;

}

 

Starting WICED vWiced_006.002.001.0002

Platform CYW954907AEVAL1F initialised

Started ThreadX v5.8

Initialising NetX_Duo v5.10_sp3

Creating Packet pools

WLAN MAC Address : 00:11:22:33:44:55

WLAN Firmware    : wl0: May 15 2018 19:39:17 version 7.15.168.114 (r689934) FWID 01-d6f88905

WLAN CLM         : API: 12.2 Data: 9.10.74 Compiler: 1.31.3 ClmImport: 1.36.3 Creation: 2018-05-15 19:33:15

Console app

   We have different options in the command input line for setting a global define. Below topic is a simple explanation for these inputs.

Actually you can also get most of them from the  makefile.  We also provide examples after wiced studio installed.

 

  • snip.scan-BCM943362WCD4

        Build for release

 

  • snip.apsta-BCM943362WCD4-debug

       Keyword:debug,

       It means if you want to use Jtag or Jlink to have a debug, you need to add this option to get a debug image.

 

  • snip.apsta-BCM943340WCD1-FreeRTOS-LwIP download run

       Keyword : FreeRTOS-LwIP download run

It means use FreeRTOS system, LwIP network protocol and use the default USB-JTAG programming interface.

 

  • demo.aws_iot.shadow-BCM94343W_AVN download_apps download run

       Keyworddownload_apps

If you want to download app into external flash by using SFLASH_WRITER_APP, you need to enable this option.

 

  • snip.scan-BCM943362WCD4-FreeRTOS-LwIP-SDIO download run

        Keyword:  FreeRTOS-LwIP-SDIO

It means using FreeRTOS system, LwIP network protocol, SDIO interface for communication.

 

  • snip.scan-BCM943362WCD4-ThreadX-NetX_Duo-SDIO download run

        Keyword:  ThreadX-NetX_Duo-SDIO

It means using Threadx OS system, Netx network protocol, SDIO interface communication.

 

  • snip.scan-BCM943362WCD4-ThreadX-NetX-SPI download run

       Keyword:  ThreadX-NetX-SPI

It means using Threadx OS system, Netx network protocol, SPI communication interface.

 

  • test.wifi_join-CYW954907AEVAL1F VERBOSE=1 download run

       Keyword: VERBOSE=1

It means compile and download log will output with a more detailed logs.

 

we also have some other options like  [JTAG=xxx]  [no_dct] [JOBS=x] ,  below comments are important for input compile options:

  Notes

    * Component names are case sensitive

    * 'WICED', 'SDIO', 'SPI' and 'debug' are reserved component names

    * Component names MUST NOT include space or '-' characters

    * Building for release is assumed unless '-debug' is appended to the target

    * Some platforms may only support a single interface bus option

 

Below are instructions for OTA2, please refer to the document carefully .

 

Key words are:

//Build an OTA2 Update Image suitable for upgrade server:

ota2_image

ota2_download

 

//Build an OTA2 Factory Reset Image suitable for manufacturing FLASHing of the device:

ota2_factory_image

ota2_factory_download

 

//It includes waf/ota2_bootloader, OTA2_factory_reset_image.bin, waf/ota2_failsafe, DCT, Application LUT, ota2_extract, and the application

ota2_manuf_image

ota2_manuf_download

 

// Below is for secure flash and version management.

APP_VERSION_FOR_OTA2_MAJOR=1

APP_VERSION_FOR_OTA2_MINOR=3

SECURE_SFLASH=1

keys=<keys_dir>

 

//show update from version of the SDK.

UPDATE_FROM_SDK=<bootloader_sdk>

 

//There were optional structures in the System DCT that are now always included. They are the Bluetooth (BT), Peer to Peer (P2P) and Over The Air 2 (OTA2) sub-structures. This information must also be designated so that the code knows which (if any) of the optional structures were used in the original application build DCT.

APP_USED_BT=1

APP_USED_P2P=1

APP_USED_OTA2=1

 

reference:

WICED Over The Air (OTA) v2 Firmware update Users Guide

riya

TCP stream API

Posted by riya Jul 29, 2018

WICED provides multiple APIs to implement a TCP connection. This blog discusses the TCP stream_read/write APIs which are more convenient for receiving/sending a large chunk of data.

The usual flow of sending TCP packets is: packet creation-> write data into packet-> set the end of the data portion-> send the packet -> delete the packet.

This method of sending TCP packets turns out to be cumbersome for large chunk of data as one has to go back and forth between packet creation and deletion. The TCP stream APIs provide a better way to stream successive data without worrying about the packet boundaries. The TCP stream APIs takes care of creating the packet and sending it unless the entire buffer is sent. The following diagram gives a simple overview of differences between existing APIs and stream APIs:

 

Please refer the wiced_tcpip.h file in 43xxx_Wi-Fi\include dir for description of the provided TCP APIs. Some of the stream APIs are listed below:

wiced_result_t wiced_tcp_stream_init( wiced_tcp_stream_t* tcp_stream, wiced_tcp_socket_t* socket );

wiced_result_t wiced_tcp_stream_write( wiced_tcp_stream_t* tcp_stream, const void* data, uint32_t data_length );

wiced_result_t wiced_tcp_stream_write_resource( wiced_tcp_stream_t* tcp_stream, const resource_hnd_t* res_id );

wiced_result_t wiced_tcp_stream_read( wiced_tcp_stream_t* tcp_stream, void* buffer, uint16_t buffer_length, uint32_t timeout );

wiced_result_t wiced_tcp_stream_read_with_count( wiced_tcp_stream_t* tcp_stream, void* buffer, uint16_t buffer_length, uint32_t timeout, uint32_t* read_count );

wiced_result_t wiced_tcp_stream_flush( wiced_tcp_stream_t* tcp_stream );

 

Please find attached the tcp_client application modified to use the wiced_tcp_stream_write() API.

This blog dicusses the download procedure on CYW43907 using external JTAG device - Jlink Segger in WICED SDK 6.2 and future releases.  Blog Downloading and debugging CYW43907 using Jlink Segger is valid only for SDKs prior to WICED SDK 6.2.

 

The hardware connections to connect CYW943907AEVAL1F's JTAG with j-link are tabulated below:

 

CYW943907AEVAL1F

Segger jlink

Signal

Pin

Signal

Pin

3v3

J9_04

VTref

1

GPIO_6_JTAG_TRST_N

J3_01

nTRST

3

Ground

J3_04

GND

4

GPIO_4_JTAG_TDI

J3_03

TDI

5

GPIO_3_JTAG_TMS

J3_07

TMS

7

GPIO_2_JTAG_TCK

J3_09

TCK

9

GPIO_5_JTAG_TDO

J3_05

TDO

13

RESET_N

J9_03

RESET

15

The switches in SW4 on CYW943907AEVAL1F need to be closed to use an external JTAG. (By default the switches are open)

 

 

To Download the application, we need J-Link tool: Please download J-Link tool from SEGGER website and install it.

For programming the image via J-Link connector, the JLink path need to be declared in WICED build string. Add the path of JLink.exe from the downloaded J-Link tool.

 

Example: For downloading test.console application, make the target as follows

test.console-CYW943907AEVAL1F JTAG=jlink-native  JLINK_PATH="C:/Program\ Files\ \(x86\)/SEGGER/JLink_V630c/" JLINK_EXE="JLink.exe" download run

Summary:

     The difference between Signal mode and Direct mode is: we only need to connect the EVB with the test AP created by AP, then AP will have a menu to test TX and RX related. Its aim is to figure out if the actual running power is matching what you want, RX path has no RF de-sense in a normal running mode.   If signal mode passed all the RF standard, we can have a confidence that current RF path include TX and RX, current RF configuration like NVRAM have no critical issues.  We can move the product into next long-run function tests.

 

  • Which EVB is for the tests?

I choose 43340 because it has 2.4G and 5G together.

  • How to set 8860C before test.

       1. Set the static IP address

   

    2.  configuration .

 

Which means creating a AP at 153 channel with 6M rate and power is -15dbm.

After AP created we use command to join the AP, then we can do the test .

 

 

  • Which application is needed for the tests?

I used the command console for the test because we can use a lot of embedded commands to join a specific AP and do some command input. 

And we are using the normal firmware for the test, please see the command output.

         test.console-BCM943340WCD1 download run

 

  • Which commands are needed before the tests?

After connection established “scan_suppress 1” , “roam_disable ” are preferred .

PM = 0 is good to be set also.

In command console:

Usage: scan_disable <1 = disable scan|0 = enable scan>

> scan_disable 1

If you didn’t have this command, please add it according another blog.

 

  • How to change country for a test ?

Please input “set country ”, then get channel , choose one channel to do connection with the AP created by instrument.

     > get_country

         Country is US (US/0)

     > set_country CN/0

     > get_country

         Country is CN (CN/0)

     > get_channels

          1  2  3 4  5  6  7  8 9  10  11 12  13  149 153  157  161 165  >

  • TX test results

 

Summary:

The Tx power test determines if transmitter path can work normally with a specific power like 18dbm at 11b 11M rate.  The RX sensitivity test determines if the receiver path can receive a relatively weak signal such as -85 db at 11b 11M rate.

 

We usually recommend that the customer use a certified partner module since the module partner themselves have already performed all the testing before releasing into the broad market. This Help Article was created to show a basic test procedure which allows the customer to determine if the issue encountered is on the RF hardware or software side.

 

 

Test machine Instructions :

MT8860C : 802.11b/g/a, 2.4G, 5G

MT8862A : IEEE802.11a/b/g/n/ac , 2.4G and 5G

IQ2010 :  802.11 a/b/g/n , 2.4G, 5G

IQxel :  802.11 a/b/g/n/ac ,  11AC HT80 and HT160

I will use MT8860C with CYW43340WCD1-EVB to show the test process.

 

Test Prepare:

please also read the application notes from WICED studio in detail.

  1. Read the doc from SDK release, WICED Manufacturing Test User Guide
  2. Wl tool, \43xxx_Wi-Fi\libraries\test\wl_tool\wl43340B0.exe
  3. Firmware, \43xxx_Wi-Fi\resources\firmware\43340\43340B0-mfgtest.bin
  4. NVRAM, \43xxx_Wi-Fi\platforms\BCM943340WCD1\wifi_nvram_image.h
  5. Script , \43xxx_Wi-Fi\libraries\test\wl_tool\scripts

Sometimes you need to update mfgtest.bin or modify NVRAM for the test, please find them in above place. Test scripts already integrate some test command lists, you can take them as a reference , sometimes we need to change some items for a test like rate, channel .

 

Test steps:

  1. test.mfg_test-BCM943340WCD1 download run
  2. After application is download and run, please use below command to make sure wl tool and serial port run well.

If you meet this issue, it means serial port is occupied. Please disable the log UART com and input the command again.

 

Make sure you will see a WLTEST string in the output.

3. connect the board to MT8860C by RF cable .

4.  Connect to MT8860C ,After scan complete, click Connect

 

5. Configure MT8860C into direct mode and the channel , rate needed.

The picture means 802.11g , channel 1 /2.4G, rate 54M, Direct mode

 

6. Set MT8860C attenuation.

Change the channel , and add the Path loss you assumed.  We often set to 1db or 1.5db with RF cable connected.

 

7. Change the script to be compliant with MT8860C setting, please see the compare.

Please see the script, we often change comport,  target WL tool,  band , channel info,  rate info.

if you meet test command problems , please raise case to us.

 

8.  If we set the power into 14dbm, please see the results.

 

9.  EVM results spec table.

You can get more from spec or Module maker, thanks.

802.11b /11Mbps : 16 dBm ± 1.5 dB @ EVM -9dB

802.11g /54Mbps : 15 dBm ± 1.5 dB @ EVM -25dB

802.11n /65Mbps : 14 dBm ± 1.5 dB @ EVM -28dB

 

10. RX sensitivity record

11b,  11Mbps PER @ -85 dBm,

11b,  1Mbps PER @ -90 dBm,

 

11g,  54Mbps PER @ -72 dBm,

11g,  6Mbps PER @ -86 dBm,

 

11n,  MCS=7 PER @ -69 dBm,

11n,  MCS=0 PER @ -85 dBm,

Target:  generate a script which can work on windows PC, and can download different build output without using eclipse to compile again.

 

1.  Add VERBOSE=1 in the Make Target area, for 43907 you can get below input:

          snip.apsta-CYW943907AEVAL1F VERBOSE=1 download download_apps run

          snip.softap_issue-CYW94343WWCD1_EVB download download_apps run

          Create two for final download switch test.

          Then you can get the detailed compile information in the Console:

 

"./tools/ARM_GNU/Win32/bin/arm-none-eabi-gcc.exe" -isystem

./tools/ARM_GNU/Win32/bin/../../include -isystem ./tools/ARM_GNU/Win32/bin/../../lib/include -isystem ./tools/ARM_GNU/Win32/bin/../../lib/include-fixed @build/snip.apsta-CYW943907AEVAL1F/libraries/WWD_for_SoC.43909_ThreadX.c_opts -o build/snip.apsta-CYW943907AEVAL1F/Modules/./WICED/WWD/internal/wwd_internal.o WICED/WWD/internal/wwd_internal.c

"./tools/ARM_GNU/Win32/bin/arm-none-eabi-gcc.exe" -isystem

./tools/ARM_GNU/Win32/bin/../../include -isystem

./tools/ARM_GNU/Win32/bin/../../lib/include -isystem ./tools/ARM_GNU/Win32/bin/../../lib/include-fixed @build/snip.apsta-CYW943907AEVAL1F/libraries/WWD_for_SoC.43909_ThreadX.c_opts -o build/snip.apsta-CYW943907AEVAL1F/Modules/./WICED/WWD/internal/wwd_management.o WICED/WWD/internal/wwd_management.c

"./tools/ARM_GNU/Win32/bin/arm-none-eabi-strip.exe" -o build/waf.sflash_write-NoOS-CYW943907AEVAL1F-P103-SoC.43909/binary/waf.sflash_write-NoOS-CYW943907AEVAL1F-P103-SoC.43909.stripped.elf  build/waf.sflash_write-NoOS-CYW943907AEVAL1F-P103-SoC.43909/binary/waf.sflash_write-NoOS-CYW943907AEVAL1F-P103-SoC.43909.elf

 

2. Filter the key string “.\tools\OpenOCD\Win32\openocd-all-brcm-libftdi.exe” , you can get all the download output command:

 

.\tools\OpenOCD\Win32\openocd-all-brcm-libftdi.exe -s .\tools\OpenOCD\scripts -f ./tools/OpenOCD/CYW9WCD1EVAL1.cfg -f ./tools/OpenOCD/BCM4390x.cfg -f apps/waf/sflash_write/sflash_write.tcl -c "sflash_write_file build/snip.apsta-CYW943907AEVAL1F/DCT.bin 0x00008000 CYW943907AEVAL1F-P103-SoC.43909 0 43909" -c shutdown >> build/openocd_log.txt 2>&1

 

.\tools\OpenOCD\Win32\openocd-all-brcm-libftdi.exe -s .\tools\OpenOCD\scripts -f ./tools/OpenOCD/CYW9WCD1EVAL1.cfg -f ./tools/OpenOCD/BCM4390x.cfg -f apps/waf/sflash_write/sflash_write.tcl -c "sflash_write_file build/waf.bootloader-NoOS-NoNS-CYW943907AEVAL1F-P103-SoC.43909/binary/waf.bootloader-NoOS-NoNS-CYW943907AEVAL1F-P103-SoC.43909.trx.bin  0x00000000 CYW943907AEVAL1F-P103-SoC.43909 1 43909" -c shutdown >> build/openocd_log.txt 2>&1

 

.\tools\OpenOCD\Win32\openocd-all-brcm-libftdi.exe -s .\tools\OpenOCD\scripts -f ./tools/OpenOCD/CYW9WCD1EVAL1.cfg -f ./tools/OpenOCD/BCM4390x.cfg -f apps/waf/sflash_write/sflash_write.tcl -c "sflash_write_file build/snip.apsta-CYW943907AEVAL1F/filesystem.bin 69632 CYW943907AEVAL1F-P103-SoC.43909 0 43909" -c shutdown >> build/openocd_log.txt 2>&1

 

.\tools\OpenOCD\Win32\openocd-all-brcm-libftdi.exe -s .\tools\OpenOCD\scripts -f ./tools/OpenOCD/CYW9WCD1EVAL1.cfg -f ./tools/OpenOCD/BCM4390x.cfg -f apps/waf/sflash_write/sflash_write.tcl -c "sflash_write_file build/snip.apsta-CYW943907AEVAL1F/binary/snip.apsta-CYW943907AEVAL1F.stripped.elf 598016 CYW943907AEVAL1F-P103-SoC.43909 0 43909" -c shutdown >> build/openocd_log.txt 2>&1

 

.\tools\OpenOCD\Win32\openocd-all-brcm-libftdi.exe -s .\tools\OpenOCD\scripts -f ./tools/OpenOCD/CYW9WCD1EVAL1.cfg -f ./tools/OpenOCD/BCM4390x.cfg -f apps/waf/sflash_write/sflash_write.tcl -c "sflash_write_file build/snip.apsta-CYW943907AEVAL1F/APPS.bin 0x00010000 CYW943907AEVAL1F-P103-SoC.43909 0 43909" -c shutdown >> build/openocd_log.txt 2>&1

 

.\tools\OpenOCD\Win32\openocd-all-brcm-libftdi.exe -s .\tools\OpenOCD\scripts -f ./tools/OpenOCD/CYW9WCD1EVAL1.cfg -f ./tools/OpenOCD/BCM4390x.cfg  -f ./tools/OpenOCD/BCM4390x_gdb_jtag.cfg -c "resume" -c shutdown >> build/openocd_log.txt 2>&1 && echo Target running

 

3. Create a Windows “.bat” file, copy above output into the .bat file, and add prefix in each string line,  you can change the echo string to describe the download info with more detail.

@echo First Step: Downloading DCT ... build/snip.apsta-CYW943907AEVAL1F/DCT.bin @ SFLASH_DCT_LOC=0x00008000   

@call .\tools\OpenOCD\Win32\openocd-all-brcm-libftdi.exe -s .\tools\OpenOCD\scripts -f ./tools/OpenOCD/CYW9WCD1EVAL1.cfg -f ./tools/OpenOCD/BCM4390x.cfg -f apps/waf/sflash_write/sflash_write.tcl -c "sflash_write_file build/snip.apsta-CYW943907AEVAL1F/DCT.bin 0x00008000 CYW943907AEVAL1F-P103-SoC.43909 0 43909" -c shutdown >> build/openocd_log.txt 2>&1

 

 

4. you need to copy the tool environment and the binary that will be downloaded into the .bat directory, I didn’t filter the only necessary tools , just copy them all with below picture:

 

   tools\OpenOCD\scripts\

  Tools\OpenOCD\Win32\

  Tools\OpenOCD\

   apps\waf\sfalsh_write\sflash_write.tcl

  All build results.   I will attach the results in this blog .

 

5.  go to the download test, and have a switch to verify the results.

 

     We already have a lot of commands listed in the command_console_wifi.h ,  but actually we need more to check the info from firmware when doing test ,

I add two commands when I am doing debug or doing basic RF test needed.

 

One is to disable roam function on RF tests.

The other is to get the supported lists for different country code and revisions.

Below is modifications,I will attached the code revised also in this blog.

 

File : command_console_wifi.h // commands added in the lists.

pastedImage_1.png

File:  command_console_wifi.c  // add callback functions.

搜狗截图20180530155422.png

File: wwd_wlioctl.h  //  to enlarge the array to get more channel results.

pastedImage_3.png

 

Now below is the test results from test.console

I have a test on: test.console-BCM943340WCD1 download run

 

> set_country US/0

wwd_sdpcm_send_iovar country results are   0

> get_channels

wwd_wifi_get_channels : 35

1  2  3 4  5  6  7  8 9  10  11 36  40  44 48  52  56 60  64  100 104  108  112 116  120  124 128  132  136 140  149  153 157  161  165 165

> set_country CN/0

wwd_sdpcm_send_iovar country results are   0

> get_channels

wwd_wifi_get_channels : 18

1  2  3 4  5  6  7  8 9  10  11 12  13  149 153  157  161 165  >

> roam_disable 1

  roam_disable = 1

Attached to this post are three examples that are specific for CYW954907AEVAL1F EVK.

These examples are briefed in the CYW954907AEVAL1F EVK User Guide.

 

Please refer to "2.2 Install Software" section of the same User Guide on how to add them.

 

Chapter "5. Code Examples" briefs about these examples in the User Guide.

vnak

Overview of SECI

Posted by vnak Apr 3, 2018

Introduction

The WLAN(802.11b/g/n), Bluetooth and Zigbee transmissions occur in the unlicensed ISM (The industrial, Scientific, and Medical) radio bands of 2.4GHz. Although they are modulated with different modulation schemes (FHSS for BT and DSSS/OFDM for WLAN), interference is bound to occur when the transmitting antennas are collocated. BT could hop into the WLAN band resulting in an exponential backoff before retransmission of packets. This degrades the performance of both BT as well as WLAN. Collaborative coexistence techniques remedies this issue by passing the channel map information from the WLAN module to the BT device.

This blog gives a brief description about the Cypress Proprietary Collaborative coexistence interface known as SECI (Serial Enhanced Coexistence Interface) and enabling it using cypress WLAN and Bluetooth devices

SECI uses the UART core(commonly named as GCI UART) to transmit ECI data. 64-bit coexistence data could be exchanged between WLAN and BT. As a result, a lot more information is passed on between the devices compared to its counterparts i.e. 3-wire and 4-wire coexistence. A refresh routine runs, that resyncronizes the devices upon waking from powersave.

The following is a logical diagram of SECI between two devices.

secipic.jpg

 

How to enable SECI in WLAN

 

Steps involved and their descriptions:

  • Modify the LSB(bit[0]) of  boardflags parameter in the NVRAM file.

To enable 2-wire(SECI) coexistence, set the last bit(bit[0]) as 1.

Eg: if boardflags=0x10010000   ->  boardflags=0x10010001

How to enable SECI in Bluetooth side

 

Adding the API wiced_bt_coex_enable() in the application, enables the SECI in BT device.

 

Frequently Asked Questions

 

Is there a concept of AFH in collaborative coexistence?

The Adaptive Frequency Hop information is not passed back to WLAN, rather WLAN module passes information on current WLAN transmit channels. BT marks them as ‘bad’ and updates the channel map.

 

What information is exchanged?

Timeout parameters(egACL,SCO timeout limits, Powersave/idle times, Medium Request/Grant times) ,

Channel bitmap,

Priority of WLAN/BT activity bitmap, etc. are the some of the information that are exchanged.

 

Can the priorities be changed?

The priorities cannot be changed. It is hardcoded.

Generally, the highest priority goes to Audio/Video/BLE/hid transfer. File transfer has the least activity.

 

Configuring sLNA or dLNA?

Cannot be changed dynamically even though NVRAM parameters exists as it in Hardware.

 

What happens during WiFi powersave?

During Wifi powersave, all the requests from Bluetooth are given full grant. This is applicable for both sLNA and dLNA. Once WiFi comes out of powersave, it runs a refresh request to notify BT that it is awake. This restarts all the coex polls between WiFi and BT.

vnak

XIP support in CYW4390x

Posted by vnak Mar 28, 2018

This blog presents the steps needed to enable XIP(eXecute-In-Place) support in CYW4390x. During normal operation, the code resides in the SFLASH and is copied to RAM during execution.The XIP feature allows instructions stored in SFLASH to be executed in place. This is suitable for instances where the RAM size is limited and application size is too large.

 

How to enable XIP

 

XIP feature is disabled by default and it can be easily enabled by adding 'xip' option to build target,

for example:

snip.scan-CYW943907AEVAL1F-xip download run

 

XIP load address, link script start address as well as XIP region length are defined in $PLATFORM/platform_xip.mk and it's configurable by users.

The following macros needs to be defined to enable XIP.

  • XIP_LINK_START_ADDRESS  : Specify the start address of XIP in linker script
  • XIP_REGION_LENGTH            : Specify the length of XIP region in linker script
  • XIP_LOAD_ADDRESS              : Specify the XIP SFLASH address. XIP binary code would be downloaded to  this address.

 

 

XIP link script:WICED/platform/MCU/BCM4390x/GCC/app_without_rom_with_xip.ld will be generated based on platform_xip.mk and its processed through the build process.

XIP binary file: *.xip.bin which contains XIPed code will be generated in build/$APP/binary/ and loaded to SFLASH.

All XIP code on SFLASH should be contiguous.

 

Limitations while using XIP

  1. XIP operation and SFLASH access are NOT allowed to operate simultaneously. SFLASH read/write(non-xip) operation can only run with interrupts disabled.
  2. The XIP image cannot be encrypted because the SFLASH controller has no HW decryption engine.
  3. OTA2 is not yet supported while using XIP.

This blog discusses how to download and debug an application on CYW43907 using external JTAG device - Jlink Segger.

NOTE: This blog is valid for WICED releases prior to WICED SDK 6.2

The hardware connections to connect CYW943907AEVAL1F's JTAG with j-link are tabulated below:

 

CYW943907AEVAL1F

Segger jlink

Signal

Pin

Signal

Pin

3v3

J9_04

VTref

1

GPIO_6_JTAG_TRST_N

J3_01

nTRST

3

Ground

J3_04

GND

4

GPIO_4_JTAG_TDI

J3_03

TDI

5

GPIO_3_JTAG_TMS

J3_07

TMS

7

GPIO_2_JTAG_TCK

J3_09

TCK

9

GPIO_5_JTAG_TDO

J3_05

TDO

13

RESET_N

J9_03

RESET

15

The switches in SW4 on CYW943907AEVAL1F need to be closed to use an external JTAG. (By default the switches are open)

 

Connect the Jlink segger to host PC. To download an application using j-link Segger, you need to change the jlink driver to libusbK.

Use Zadig to change the jlink driver.

 

Check the device manager of host PC to verify that J-link segger appears under libusbK USB devices.

 

Modify the configuration file( tools/OpenOCD/BCM4390x.cfg) to include the mode flags as follows:

replace reset_config srst_nogate connect_assert_srst with

reset_config trst_and_srst srst_push_pull srst_nogate connect_assert_srst

 

To build scan application using external JTAG, the make target should contain "JTAG=jlink" in the build string.

Make the target as: snip.scan-CYW943907AEVAL1F-debug JTAG=jlink download run

 

Please note that the download is using openOCD in WICED SDK.

To debug an application, you need to revert back the driver for jlink from libusbK to Segger. Right click on jlink under libusbK and update driver. Choose "Search automatically for updated driver software". This will install the jlink driver. Jlink will appear as J-link driver under Universal Serial Bus Controllers.

Install JLink on your machine. Follow the instructions:

@SEGGER - The Embedded Experts - Downloads

 

Disable the Watchdog by adding the following flag in the make file of your application:
GLOBAL_DEFINES += WICED_DISABLE_WATCHDOG

 

Follow the instructions given in the attached document for setting the debug configurations in WICED SDK.

grsr

Debugging TLS in WICED

Posted by grsr Mar 12, 2018

This blog post shows how to use macros in WICED to debug TLS (Transport Layer Security) data. The mbedTLS library provides debug macros MBEDTLS_DEBUG_C, MBEDTLS_SSL_DEBUG_ALL and MBEDTLS_DEBUG_LOG_LEVEL defined in /WICED/security/BESL/mbedtls_open/include/mbedtls/config.h and they are disabled by default. You can enable those macros and define MBEDTLS_DEBUG_LOG_LEVEL as per the level of debugging required. Higher the level, more details can be captured in the logs. The log levels are defined as shown below:

 

0 No debug

1 Error

2 State change

3 Informational

4 Verbose

 

In addition, you also need to enable WPRINT_ENABLE_SECURITY_DEBUG in /include/wiced_defaults.h. Please note that debug printing consumes a lot of memory so you need to allocate at least 4 kB to the stack of every thread that uses debug printing.

Filter Blog

By date:
By tag: