Wi-Fi Combo Forum Discussions
Hi there,
I would like to implement an OTA2 update service for an embedded device which has the BCM943907_QUADRO module on it. Within the WICED SDK directory there is a PDF which explains a lot of the OTA2 procedure. Sadly I can not flash the board with the compiled image from that tutorial.
I was very happy to flash the device with the documentation written on thread OTA2 Update for SDK-3.7.0 because there are different calls for the makefiles (which could have an effect on the actual software built I guess) I tried both ways for getting the OTA2 working. Therefore the PDF given by the WICED SDK was outdated but the revision log didn't say so. Please change the PDF contents in a future revision to avoid complication! Especially 14.2 (how to build ota2_extract) was my guideline. Even the comments within the ota2_extract.c and ota2_example.c were not helpful
Nevertheless I was able to build an OTA2 update support with the required functionality. The soft ap mode worked fine and I was able to upload the snip.scan example to my board
Now there are new errors on the current progress:
I've build the ota2_extract and ota2_example and was able to flash the board. After updating to the snip.scan example I wanted to get into the firmware reset state of the bootloader so I hold the defined reset pin for around 11 seconds. Then I've got this output on the command line:
Hi, I'm the OTA2 extraction app (ota2_extract).
Extract the Factory Reset!
Do not copy over Saved DCT.
Extract From Factory Reset FAILED!
Extract done - REBOOTING
Hi, I'm the OTA2 extraction app (ota2_extract).
Extract the Factory Reset!
Do not copy over Saved DCT.
Extract From Factory Reset FAILED!
Extract done - REBOOTING
...
...(repeating forever)
Did I forget to compile a firmware reset image and flash it to the board? How can I achieve this? What are the available makefile calls? What is the correct syntax to create some failsafe images?
Thanks in advance
Thomas
PS: In a prior question I asked something similar (Struggling creating a factory reset app ) but to be honest I hadn't heard of the OTA2 Update for SDK-3.7.0 thread at that time.
Show LessHi,
I downloaded new SDK which is studio5.2 and now try to test snip.scan with 4343WCD1 EVK, however there's no scan result
so I upgraded firmware to the one in the SDK which is "4343WA1.bin" but it was in vain.
With the EVB I have no problem with Wiced Studio 5.0.2
Does studio 5.2 support W4343CD1?
Thanks,
Soohwan.
Show LessThere is an invalid enumerated type conversion in the WICED 4.1 OTA2 bootloader. The function wiced_ota2_image_get_status() takes a wiced_ota2_image_type_t as its first parameter, but value passed in is an ota2_boot_type_t: OTA2_BOOT_UPDATE. This value isn't equivalent to any wiced_ota2_image_type_t so it will trigger the default behavior for any invalid image type. I'm not sure what the significance of this is. I was trying to fix something else when I ran across this bug.
int main( void ) // SEE apps/waf/ota2_bootloader/ota2_bootloader.c
{...
wiced_result_t result;
...
/* Check for Watchdog reset
* This overrides everything. Use ota2_failsafe to recover
*/
if (platform_watchdog_check_last_reset() == WICED_TRUE)
{
/* watchdog reset happened - which image do we try to use? */
wiced_ota2_image_status_t staged_update_status;
...
/* if the downloaded image is good, use that over the factory reset */
result = wiced_ota2_image_get_status( /*bug - should be and image type not a boot type*/OTA2_BOOT_UPDATE, &staged_update_status );
...
}
}
// SEE libraries/filesystems/ota2/wiced_ota2_image.h for the following:
typedef enum
{
OTA2_BOOT_NEVER_RUN_BEFORE = 0, /* Do not change this ENUM location */
OTA2_BOOT_NORMAL, /* Do not change this ENUM location */
/* Use these after failsafe recovery to continue the ota2 extraction preocess */
OTA2_BOOT_EXTRACT_FACTORY_RESET, /* Renamed in SDK-4.0.1, but stays the same ENUM as SDK OTA2_BOOT_FACTORY_RESET */
OTA2_BOOT_EXTRACT_UPDATE, /* Renamed in SDK-4.0.1, but stays the same ENUM as SDK OTA2_BOOT_FACTORY_RESET */
OTA2_BOOT_SOFTAP_UPDATE, /* Do not change this ENUM location */
OTA2_BOOT_LAST_KNOWN_GOOD, /* Do not change this ENUM location */
OTA2_BOOT_FACTORY_RESET,
OTA2_BOOT_UPDATE,
/* Use these before starting an extraction. If extraction is interrupted, use failsafe */
OTA2_BOOT_FAILSAFE_FACTORY_RESET,
OTA2_BOOT_FAILSAFE_UPDATE,
OTA2_MAX_BOOT_TYPES /* Not a valid boot type */
} ota2_boot_type_t;
typedef enum
{
WICED_OTA2_IMAGE_TYPE_NONE = 0,
WICED_OTA2_IMAGE_TYPE_FACTORY_RESET_APP,
WICED_OTA2_IMAGE_TYPE_CURRENT_APP,
WICED_OTA2_IMAGE_TYPE_LAST_KNOWN_GOOD,
WICED_OTA2_IMAGE_TYPE_STAGED
} wiced_ota2_image_type_t;
Show LessHi,
I have 2 versions of my code:
Version 1 : wiced 3.7 with 8 section in external memory
DCT_IMAGE_ENTRY_COUNT := 0
FILESYSTEM_IMAGE_ENTRY_COUNT := 1
WIFI_FIRMWARE_ENTRY_COUNT := 2
FR_APP_ENTRY_COUNT := 3
OTA_APP_ENTRY_COUNT := 4
APP0_ENTRY_COUNT := 5
APP1_ENTRY_COUNT := 6
APP2_ENTRY_COUNT := 7
Version 2 : wiced 5.1 with 9 section in external memory
DCT_IMAGE_ENTRY_COUNT := 0
FILESYSTEM_IMAGE_ENTRY_COUNT := 1
FR_WIFI_FIRMWARE_ENTRY_COUNT := 2
FR_APP_ENTRY_COUNT := 3
OTA_APP_ENTRY_COUNT := 4
APP0_ENTRY_COUNT := 5
APP1_ENTRY_COUNT := 6
APP2_ENTRY_COUNT := 7
WIFI_FIRMWARE_ENTRY_COUNT := 8
in version 2
FR_APP is the version 1 application
FR_WIFI_FIRMWARE is the version 1 wifi firmware
The version 2 works perfectly but when I make the factory reset the version 1 start but reboot each time when FreeRTOS start.
any idea ?
Show LessHello
I have my own external debugger that I want to hook into the STM32F4 on the BCM94343WWCD1_1. The blue shrouded header (J3) appears to correspond to what I want. But when I try to open the connection, although I can read the voltage, I appear to be unable to reset the device.
Is the on-board debugger holding onto this pin? Is there a resistor I can remove so that my external debugger may toggle?
I've looked at the schematics for the BCM94343WWCD1_1 but they seem to entirely omit the information from the black board. Where can I find those schematics? I could help myself if I was able to find them.
Best,
Louis
FYI, the eval board that I am mounted on appears to be the BCM9WCD9EVAL1. Unfortunately, it's schematics are not in WICED-Studio-5.1/43xxx_Wi-Fi/platforms/evaluation_boards
Show Less
I'm looking for the pinout for the J7 header on this evaluation board but can only find schematics for the BCM943364WCD1 module. Where can I find schematics for this EVB?
Regards,
Florian
Show LessThis fix resolve 2 issues, which reported her Possible OTA bug? :
1. app_header array overflow (..crash)
2. OTA update crash after 9 incremental firmware updates
Not resolve issues:
1. Crash after 112 incremental updates
2. Crash OTA update after factory restore *(if was before an update and new firmware sizes different by 1 sector). To resolve this, need clear apps headers sector in spi flash and restore default header.
wiced_result_t wiced_apps_set_size( image_location_t* app_header_location, uint32_t size )
{
sflash_handle_t sflash_handle;
app_header_t app_header;
uint8_t index;
uint32_t current_size = 0;
uint16_t empty_sector;
unsigned long flash_memory_size;
uint32_t available_sectors;
uint32_t sectors_needed;
init_sflash( &sflash_handle, PLATFORM_SFLASH_PERIPHERAL_ID, SFLASH_WRITE_NOT_ALLOWED );
sflash_read( &sflash_handle, app_header_location->detail.external_fixed.location, &app_header, sizeof(app_header_t) );
for ( index = 0; index < app_header.count; index++ )
{
current_size += app_header.sectors[ index ].count;
}
current_size *= SFLASH_SECTOR_SIZE;
if ( current_size >= size )
{
deinit_sflash( &sflash_handle);
return WICED_SUCCESS;
}
current_size = ( size - current_size );
sectors_needed = current_size / SFLASH_SECTOR_SIZE;
sectors_needed = ( current_size % SFLASH_SECTOR_SIZE ) ? ( sectors_needed + 1 ) : ( sectors_needed );
deinit_sflash( &sflash_handle);
//darius internaly check new header that do not overload next sector this about 112 times if each firmare bigger. Internaly was change
if ( wiced_apps_find_empty_location( app_header_location, &empty_sector ) != WICED_SUCCESS )
{
return WICED_ERROR;
}
sflash_get_size( &sflash_handle, &flash_memory_size );
available_sectors = ( flash_memory_size / SFLASH_SECTOR_SIZE ) - empty_sector;
/* Check whether number of sectors which are empty is more that the number of sectors required for an application */
if ( sectors_needed > available_sectors )
{
wiced_assert("Flash memory doesn't have enough space for this application update", 0!=0);
/* Application with requested size wont fit into flash memory chip */
return WICED_ERROR;
}
#if 1
/*Darius. Trivial change. Check whether number of sections which are empty is more that the number of sectors required for an application */
if ( app_header.count >= sizeof(app_header.sectors)/sizeof(app_header.sectors[0]) )
{
wiced_assert("App_header sections doesn't have enough space for this application update. Total error.", 0!=0);
/* We have sflash memory defragmentation */
return WICED_ERROR;
}
if( app_header.count>0 && (app_header.sectors[ app_header.count-1].start+app_header.sectors[ app_header.count-1 ].count)==empty_sector ){
app_header.sectors[ app_header.count-1].count += (uint16_t) sectors_needed;
}
else{
app_header.sectors[ app_header.count ].start = empty_sector;
app_header.sectors[ app_header.count++ ].count = (uint16_t) sectors_needed;
}
#else
app_header.sectors[ app_header.count ].start = empty_sector;
app_header.sectors[ app_header.count++ ].count = (uint16_t) sectors_needed;
#endif
init_sflash( &sflash_handle, PLATFORM_SFLASH_PERIPHERAL_ID, SFLASH_WRITE_ALLOWED );
/* printf("sectory count %d %d %d\n", app_header.count, app_header.sectors[ app_header.count-1 ].start, app_header.sectors[ app_header.count-1 ].count); */
sflash_write( &sflash_handle, app_header_location->detail.external_fixed.location, &app_header, sizeof(app_header_t) );
memset(&app_header,0xFFFFFFFF, sizeof(app_header_t));//clear buffer
sflash_read( &sflash_handle, app_header_location->detail.external_fixed.location, &app_header, sizeof(app_header_t) );
/* printf("sectory count %d %d %d\n", app_header.count, app_header.sectors[ app_header.count-1 ].start, app_header.sectors[ app_header.count-1 ].count); */
deinit_sflash( &sflash_handle);
return WICED_SUCCESS;
}
Show LessIn wwd_assert.c there is a bug the will cause the system to fail to build if the DEBUG and WPRINT_ENABLE_ERROR is enabled.
There are missing braces around the WPRINT_MACRO - current source is:
#define wiced_minor_assert( error_string, assertion ) do { if ( !(assertion) ) WPRINT_MACRO( error_string ); } while(0)
corrected source is:
#define wiced_minor_assert( error_string, assertion ) do { if ( !(assertion) ) WPRINT_MACRO( ( error_string ) ); } while(0)
This is on line 56 - Please correct for next release.
Show LessHi there,
I would like to get a firmware reset app running. This should be accessible by holding a specific button for more than X ms at the system startup.
If I try to build the program by the makefile call "apps.FirmwareReset-BCM943907_QUADRO-ThreadX download download_apps run" (like suggested within snip.ota_fr) I can not access the factory reset program. What can I do to make that working?
I made some changes within platform.c and platform.h
// ... platform.h
/* Bootloader OTA and OTA2 factory reset during settings */
#define PLATFORM_FACTORY_RESET_BUTTON_INDEX ( PLATFORM_BUTTON_1 )
#define PLATFORM_FACTORY_RESET_TIMEOUT ( 10000 )
// ... platform.c
const gpio_button_t platform_gpio_buttons[] =
{
[PLATFORM_BUTTON_1] =
{
.polarity = WICED_ACTIVE_LOW,
.gpio = PIN_PWM_0,
.trigger = IRQ_TRIGGER_FALLING_EDGE,
},
[PLATFORM_BUTTON_2] =
{
.polarity = WICED_ACTIVE_LOW,
.gpio = PIN_PWM_1,
.trigger = IRQ_TRIGGER_FALLING_EDGE,
}
};
uint32_t platform_get_button_press_time ( int button_index, uint32_t max_time )
{
int button_gpio;
uint32_t button_press_timer = 0;
/* Initialize input */
button_gpio = platform_gpio_buttons[button_index].gpio;
platform_gpio_init( &platform_gpio_pins[ button_gpio ], INPUT_PULL_UP );
while ( (PLATFORM_BUTTON_PRESSED_STATE == platform_gpio_input_get(&platform_gpio_pins[ button_gpio ])) )
{
/* wait a bit */
host_rtos_delay_milliseconds( PLATFORM_BUTTON_PRESS_CHECK_PERIOD );
/* keep track of time */
button_press_timer += PLATFORM_BUTTON_PRESS_CHECK_PERIOD;
if ((max_time > 0) && (button_press_timer >= max_time))
{
break;
}
}
return button_press_timer;
}
uint32_t platform_get_factory_reset_button_time ( uint32_t max_time )
{
return platform_get_button_press_time ( PLATFORM_FACTORY_RESET_BUTTON_INDEX, max_time );
}
The main application looks like this:
Show Lessvoid application_start( )
{
wiced_config_soft_ap_t* soft_ap;
wiced_result_t result;
wiced_init( );
char ssid_name[63];
char ssid_pass[63];
/* Get the SoftAP name and output to console */
result = wiced_dct_read_lock( (void**) &soft_ap, WICED_FALSE, DCT_WIFI_CONFIG_SECTION, OFFSETOF(platform_dct_wifi_config_t, soft_ap_settings), sizeof(wiced_config_soft_ap_t) );
if ( result == WICED_SUCCESS )
{
if(strcmp(ssid_name, (char*)soft_ap->SSID.value[0]) != 0)
{
WPRINT_APP_INFO( ( "\r\nUpdating the SSID Name\n\r") );
memcpy(soft_ap->SSID.value, ssid_name,9);
soft_ap->SSID.length = 9;
soft_ap->security = WICED_SECURITY_OPEN;
}
wiced_dct_write(soft_ap, DCT_WIFI_CONFIG_SECTION, OFFSETOF(platform_dct_wifi_config_t, soft_ap_settings), sizeof(wiced_config_soft_ap_t));
wiced_dct_read_unlock( soft_ap, WICED_FALSE );
}
result = wiced_dct_read_lock( (void**) &soft_ap, WICED_FALSE, DCT_WIFI_CONFIG_SECTION, OFFSETOF(platform_dct_wifi_config_t, soft_ap_settings), sizeof(wiced_config_soft_ap_t) );
if ( result == WICED_SUCCESS )
{
WPRINT_APP_INFO( ( "\r\n\r\nSoftAP start, AP name: %s\r\n", soft_ap->SSID.value));
WPRINT_APP_INFO( ( "\tPassword: %s\r\n\r\n", soft_ap->security_key));
}
wiced_rtos_delay_milliseconds(200);
/* Bringup the network interface */
wiced_network_up( WICED_AP_INTERFACE, WICED_USE_INTERNAL_DHCP_SERVER, &device_init_ip_settings );
wiced_ota_server_start( WICED_AP_INTERFACE );
while ( 1 )
{
wiced_rtos_delay_milliseconds( 100 );
}
}