Skip to content

Commit a47b365

Browse files
committed
PSOC6: send HCI reset after patch RAM download
After the patch RAM download is completed, a HCI reset should be sent in order to initialize the registers. Some of the initialization won't be called if the HCI reset is not sent after firmware download.
1 parent e03b3b6 commit a47b365

File tree

1 file changed

+19
-2
lines changed
  • features/FEATURE_BLE/targets/TARGET_Cypress/TARGET_CYW43XXX

1 file changed

+19
-2
lines changed

features/FEATURE_BLE/targets/TARGET_Cypress/TARGET_CYW43XXX/HCIDriver.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ static const uint8_t pre_brcm_patchram_buf[] = {
3434
0x03, 0x0C, 0x00,
3535
0x2E, 0xFC, 0x00,
3636
};
37+
static const uint8_t post_brcm_patchram_buf[] = {
38+
// RESET cmd
39+
0x03, 0x0C, 0x00,
40+
};
41+
3742
static const int pre_brcm_patch_ram_length = sizeof(pre_brcm_patchram_buf);
43+
static const int post_brcm_patch_ram_length = sizeof(post_brcm_patchram_buf);
3844

3945
#define HCI_RESET_RAND_CNT 4
4046
#define HCI_VS_CMD_SET_SLEEP_MODE 0xFC27
@@ -278,12 +284,24 @@ class HCIDriver : public cordio::CordioHCIDriver {
278284
{
279285
service_pack_ptr = brcm_patchram_buf;
280286
service_pack_length = brcm_patch_ram_length;
281-
service_pack_next = &HCIDriver::terminate_service_pack_transfert;
287+
service_pack_next = &HCIDriver::post_service_pack_transfert;
282288
service_pack_index = 0;
283289
service_pack_transfered = false;
284290
send_service_pack_command();
285291
}
286292

293+
// Called once brcm_patchram_buf has been transferred; send post_brcm_patchram_buf
294+
void post_service_pack_transfert(void)
295+
{
296+
service_pack_ptr = post_brcm_patchram_buf;
297+
service_pack_length = post_brcm_patch_ram_length;
298+
service_pack_next = &HCIDriver::terminate_service_pack_transfert;;
299+
service_pack_index = 0;
300+
service_pack_transfered = false;
301+
wait_ms(1000);
302+
send_service_pack_command();
303+
}
304+
287305
// Called once post_brcm_patchram_buf has been transferred; start regular initialization.
288306
void terminate_service_pack_transfert(void)
289307
{
@@ -292,7 +310,6 @@ class HCIDriver : public cordio::CordioHCIDriver {
292310
service_pack_next = NULL;
293311
service_pack_index = 0;
294312
service_pack_transfered = true;
295-
wait_ms(1000);
296313
set_sleep_mode();
297314
}
298315

0 commit comments

Comments
 (0)