Hi all!
I have been spending too much time now in getting the CC3000 to work on a STM32(M0) microcontroller. Aside from the typical porting issues around SPI, I have run into various bugs in the Host Driver, that I think would be nice to share.
1) nvmem_read: If there is some delay between the 'hci_command_send' and the 'SimpleLinkWaitEvent' calls (which could be caused by debug printf's, debugging using JTAG or even by a run-time interrupt handler), the statemachine locks up. The reason behind this is because the event will be received prior to the SimpleLinkWaitEvent call, the event is incorrectly handled as an unsolicited event, because the state variable tSLInformation.usRxEventOpcode is still at 0. The function 'hci_unsol_event_handler' incorrectly returns '1' in this case, indicating that the event was already handled. So I added this piece of code before the last if in this function:
// handle the case that the event was not unsolicited, but that the RxEventOpcode was not yet set by
// SimpleLinkWaitEvent. Do *NOT* indicate that the event was handled in this case!!
if (tSLInformation.usRxEventOpcode == 0) {
return 0;
}
2) In the function 'wlan_smart_config_set_prefix', the three captical T characters are written back to the memory location that is passed through cNewPrefix. Aside from being a bad practice, it crashed my STM32 because obviously this pointer points to a .rodata area, which resides in Flash. This caused a bus-error trap. I removed the statements, because the pointer to the string "TTT" is valid anyhow. It would be better to ignore the pointer and just use a local static instead.