Driver for CC3000 Wi-Fi module
Dependencies: NVIC_set_all_priorities
Dependents: CC3000_Simple_Socket Wi-Go_IOT_Demo
Information
The current code has been reworked to a full object oriented application and contains an mbed socket compatible API.
CC3000 Wi-Fi module library
Info
This is the low level driver for TI's SimpleLink CC3000 device.
Port from Avnet's Wi-Go KEIL code (based on TI's CC3000 code).
Special thanks to Jim Carver from Avnet for providing the Wi-Go board and for his assistance.
Differences with TI's original code
The code functionality stays exactly the same.
In order to make it easier to use the code, following changes were made :
- Addition of a tool to shift all IRQ priorities to a lower level since it is very important to keep the SPI handler at the highest system priority, the WLAN interrupt the second highest and all other system interrupts at a lower priority, so their handlers can be preempted by the CC3000 interrupts.
- Addition of low level I/O controls and conditional compiler controls in cc3000_common.h.
- CC3000 initialisation, pin declarations, SPI and WLAN irq priorities are set in
Init_HostDriver
, we need to call this function at the start of the main function. - The SPI and HCI code are joined into one file.
- The include list has been rearranged - Only
#include "wlan.h"
is needed in the user API.
- Part of the CC3000's user eeprom memory is used to store additional info (52 bytes in NVMEM_USER_FILE_1):
# bytes | Description | Info |
1 | First time config parameter | Useful when connecting |
2 | Firmware updater version | used with the Firmware update tool |
2 | Service Pack version | used with the Firmware update tool |
3 | Driver Version | used with the Firmware update tool |
3 | Firmware Version | used with the Firmware update tool |
1 | CIK validation (Client Interface Key) | |
40 | CIK data (Client Interface Key) | used with the exosite |
Using the Library
A user API is needed to access the CC3000 functions.
Examples:
- Internet Of Things full WiGo demo (SmartConfig - WebServer - Exosite - Android sensor Fusion App)
- CC3000_Simple_Socket
Using the library with other processors
cc3000_common.cpp
loads the irq tool for all targets:
All current mbed targets are supported by this library.
#include "NVIC_set_all_priorities.h"
All low level settings that need to change are available in cc3000_common.h
//***************************************************************************** // PIN CONTROLS & COMPILE CONTROLS //***************************************************************************** // Compiler control #define CC3000_UNENCRYPTED_SMART_CONFIG // No encryption //#define CC3000_TINY_DRIVER // Driver for small memory model CPUs //Interrupt controls #define NVIC_ALL_IRQ NVIC_set_all_irq_priorities(3); // Set ALL interrupt priorities to level 3 #define NVIC_SPI_IRQ NVIC_SetPriority(SPI0_IRQn, 0x0); // Wi-Fi SPI interrupt must be higher priority than SysTick #define NVIC_PORT_IRQ NVIC_SetPriority(PORTA_IRQn, 0x1); #define NVIC_SYSTICK_IRQ NVIC_SetPriority(SysTick_IRQn, 0x2); // SysTick set to lower priority than Wi-Fi SPI bus interrupt //#define NVIC_ADC_IRQ NVIC_SetPriority(ADC0_IRQn, 0x3); // ADC is the lowest of all // Wlan controls #define WLAN_ISF_PCR PORTA->PCR[16] #define WLAN_ISF_ISFR PORTA->ISFR #define WLAN_ISF_MASK (1<<16) #define WLAN_ASSERT_CS wlan_cs = 0; //CS : active low #define WLAN_DEASSERT_CS wlan_cs = 1; #define WLAN_ASSERT_EN wlan_en = 1; //EN : active high #define WLAN_DEASSERT_EN wlan_en = 0; #define WLAN_READ_IRQ wlan_int #define WLAN_ENABLE_IRQ wlan_int.fall(&WLAN_IRQHandler); #define WLAN_DISABLE_IRQ wlan_int.fall(NULL); #define WLAN_IRQ_PIN_CREATE InterruptIn wlan_int (PTA16); #define WLAN_EN_PIN_CREATE DigitalOut wlan_en (PTA13); #define WLAN_CS_PIN_CREATE DigitalOut wlan_cs (PTD0); #define WLAN_SPI_PORT_CREATE SPI wlan(PTD2, PTD3, PTC5); // mosi, miso, sclk #define WLAN_SPI_PORT_INIT wlan.format(8,1); #define WLAN_SPI_SET_FREQ wlan.frequency(12000000); #define WLAN_SPI_SET_IRQ_HANDLER wlan_int.fall(&WLAN_IRQHandler); #define WLAN_SPI_WRITE wlan.write(*data++); #define WLAN_SPI_READ wlan.write(0x03); // !! DO NOT MODIFY the 0x03 parameter (CC3000 will not respond).
API documentation
Due to a little problem with the links on the mbed site, the API documentation is not directly accessible (will be solved in a next release).
Currently, it is only accessible by adding modules.html
to the API doc link: http://mbed.org/users/frankvnk/code/CC3000_Hostdriver/docs/tip/modules.html
Revision 3:3818c9c7b14e, committed 2013-07-13
- Comitter:
- frankvnk
- Date:
- Sat Jul 13 13:12:46 2013 +0000
- Parent:
- 2:f1d50c7f8bdb
- Child:
- 4:d8255a5aad46
- Commit message:
- first working version
Changed in this revision
--- a/CC3000_spi.cpp Mon Jul 08 13:18:12 2013 +0000 +++ b/CC3000_spi.cpp Sat Jul 13 13:12:46 2013 +0000 @@ -186,7 +186,7 @@ else { -//printf("Write\n"); +//printf("SPIW\n"); // We need to prevent here race that can occur in case 2 back to back packets are sent to the // device, so the state will move to IDLE and once again to not IDLE due to IRQ tSLInformation.WlanInterruptDisable(); @@ -205,7 +205,7 @@ // check for a missing interrupt between the CS assertion and interrupt enable if (tSLInformation.ReadWlanInterruptPin() == 0) { -//printf("INT missed\n"); +//printf("IRQ-MISSED\n"); SpiWriteDataSynchronous(sSpiInformation.pTxPacket, sSpiInformation.usTxPacketLength); sSpiInformation.ulSpiState = eSPI_STATE_IDLE; wlan_cs = 1; @@ -215,7 +215,7 @@ // Due to the fact that we are currently implementing a blocking situation, wait until the transaction ends while (sSpiInformation.ulSpiState != eSPI_STATE_IDLE); - +//printf("SPIW-E\n"); return(0); } @@ -236,7 +236,7 @@ //***************************************************************************** void SpiWriteDataSynchronous(unsigned char *data, unsigned short size) { -//printf("W %02i : ",size); +// ----------------------------- printf("W %02i : ",size); for (; size > 0 ; size--) { //printf("%02X ",*data); @@ -260,7 +260,7 @@ void SpiReadDataSynchronous(unsigned char *data, unsigned short size) { long i = 0; -//printf("R %02i : ",size); +// ----------------------------- printf("R %02i : ",size); for (i = 0; i < size; i++) { data[i] = wlan.write(READ); @@ -440,14 +440,18 @@ // NVIC_ClearPendingIRQ(PORTA_IRQn); // WLAN_ISF_PCR |= PORT_PCR_ISF_MASK; // WLAN_ISF_ISFR |= WLAN_ISF_MASK; -//printf("IRQ\n"); + +//IRQ_cnt++; +//printf("I"); if (sSpiInformation.ulSpiState == eSPI_STATE_POWERUP) { +// ----------------------------- printf("IRQPU\n"); // Inform HCI Layer that IRQ occured after powerup sSpiInformation.ulSpiState = eSPI_STATE_INITIALIZED; } else if (sSpiInformation.ulSpiState == eSPI_STATE_IDLE) { +// ----------------------------- printf("IRQID\n"); sSpiInformation.ulSpiState = eSPI_STATE_READ_IRQ; /* IRQ line goes low - acknowledge it */ wlan_cs = 0; @@ -457,10 +461,12 @@ } else if (sSpiInformation.ulSpiState == eSPI_STATE_WRITE_IRQ) { +// ----------------------------- printf("IRQWI\n"); SpiWriteDataSynchronous(sSpiInformation.pTxPacket, sSpiInformation.usTxPacketLength); sSpiInformation.ulSpiState = eSPI_STATE_IDLE; wlan_cs = 1; } +// ----------------------------- printf("IRQ-E\n"); } //*****************************************************************************
--- a/CC3000_spi.h Mon Jul 08 13:18:12 2013 +0000 +++ b/CC3000_spi.h Sat Jul 13 13:12:46 2013 +0000 @@ -100,7 +100,6 @@ }tSpiInformation; extern unsigned char wlan_tx_buffer[]; - void SpiWriteDataSynchronous(unsigned char *data, unsigned short size); void SpiWriteAsync(const unsigned char *data, unsigned short size); void SpiPauseSpi(void); @@ -127,3 +126,4 @@ #endif +
--- a/GlobalAssigns.h Mon Jul 08 13:18:12 2013 +0000 +++ b/GlobalAssigns.h Sat Jul 13 13:12:46 2013 +0000 @@ -28,6 +28,7 @@ extern InterruptIn wlan_int; extern void WLAN_IRQHandler(void); extern SPI wlan; +//extern int IRQ_cnt; #endif
--- a/cc3000.cpp Mon Jul 08 13:18:12 2013 +0000 +++ b/cc3000.cpp Sat Jul 13 13:12:46 2013 +0000 @@ -40,7 +40,11 @@ DigitalOut wlan_cs (PIN_WLAN_CS); SPI wlan(PIN_MOSI, PIN_MISO, PIN_SCLK); // mosi, miso, sclk -extern int ueh_enable; +//extern int ueh_enable; +// +// Smart Config Prefix +// +char aucCC3000_prefix[] = {'T', 'T', 'T'}; long ulSocket; @@ -184,10 +188,10 @@ //printf("\nWlan init done\n"); // Trigger a WLAN device wlan_start(cRequestPatch); -//printf("\nWlan start done\n"); - wlan_smart_config_set_prefix((char *)aucCC3000_prefix); - wlan_ioctl_set_connection_policy(0, 0, 0); - wlan_ioctl_del_profile(255); +//if(cRequestPatch == 0) printf("\nWlan start done\n"); + wlan_smart_config_set_prefix(aucCC3000_prefix); +// wlan_ioctl_set_connection_policy(0, 0, 0); +// wlan_ioctl_del_profile(255); // Mask out all non-required events from CC3000 wlan_set_event_mask(HCI_EVNT_WLAN_KEEPALIVE| @@ -195,7 +199,7 @@ HCI_EVNT_WLAN_ASYNC_PING_REPORT); // Check unsolicited events - hci_unsolicited_event_handler(); +// hci_unsolicited_event_handler(); //ueh_enable = 1; return(0); } @@ -334,7 +338,7 @@ wlan_cs = 1; wlan.format(8,1); - wlan.frequency(1000000); + wlan.frequency(12000000); wlan_int.fall(&WLAN_IRQHandler); // NVIC_DisableIRQ(PORTA_IRQn); @@ -419,3 +423,4 @@ wlan_en = 0; } } +
--- a/cc3000.h Mon Jul 08 13:18:12 2013 +0000 +++ b/cc3000.h Sat Jul 13 13:12:46 2013 +0000 @@ -47,7 +47,7 @@ #include "cc3000_common.h" #include "CC3000_spi.h" #include "hci.h" -#include "cc3000.h" +//#include "cc3000.h" /** CC3000 Functions * @@ -77,10 +77,6 @@ #else // ---------------------------------------------------------- PATCHPROGRAMMER_ENABLE end #endif // -------------------------------------------------------- NON-PATCHPROGRAMMER_ENABLE end -// -// Smart Config Prefix -// -const char aucCC3000_prefix[] = {'T', 'T', 'T'}; // CC3000 State Machine Definitions enum cc3000StateEnum
--- a/evnt_handler.cpp Mon Jul 08 13:18:12 2013 +0000 +++ b/evnt_handler.cpp Sat Jul 13 13:12:46 2013 +0000 @@ -144,14 +144,14 @@ if (patch) { -printf("HCI_EVENT_PATCHES_DRV_REQ\n"); +// ----------------------------- printf("HCI_EVENT_PATCHES_DRV_REQ\n"); hci_patch_send(HCI_EVENT_PATCHES_DRV_REQ, tSLInformation.pucTxCommandBuffer, patch, ucLength); return; } } // Send 0 length Patches response event -printf("HCI_EVENT_PATCHES_DRV_REQ - NULL\n"); +// ----------------------------- printf("HCI_EVENT_PATCHES_DRV_REQ - NULL\n"); hci_patch_send(HCI_EVENT_PATCHES_DRV_REQ, tSLInformation.pucTxCommandBuffer, 0, 0); break; @@ -164,22 +164,25 @@ // Build and send a patch if (patch) { -printf("HCI_EVENT_PATCHES_FW_REQ\n"); +// ----------------------------- printf("HCI_EVENT_PATCHES_FW_REQ\n"); hci_patch_send(HCI_EVENT_PATCHES_FW_REQ, tSLInformation.pucTxCommandBuffer, patch, ucLength); return; } } // Send 0 length Patches response event -printf("HCI_EVENT_PATCHES_FW_REQ - NULL\n"); +// ----------------------------- printf("HCI_EVENT_PATCHES_FW_REQ - NULL\n"); +//printf("HEPFR %04X\n",HCI_EVENT_PATCHES_FW_REQ); +//printf("pucTCB %04X\n",*tSLInformation.pucTxCommandBuffer); hci_patch_send(HCI_EVENT_PATCHES_FW_REQ, tSLInformation.pucTxCommandBuffer, 0, 0); +//printf("HEPFR-E\n"); break; case HCI_EVENT_PATCHES_BOOTLOAD_REQ: if (tSLInformation.sBootLoaderPatches) { -printf("HCI_EVENT_PATCHES_BOOTLOAD_REQ\n"); +// ----------------------------- printf("HCI_EVENT_PATCHES_BOOTLOAD_REQ\n"); patch = tSLInformation.sBootLoaderPatches(&ucLength); if (patch) { @@ -189,7 +192,7 @@ } // Send 0 length Patches response event -printf("HCI_EVENT_PATCHES_BOOTLOAD_REQ - NULL\n"); +// ----------------------------- printf("HCI_EVENT_PATCHES_BOOTLOAD_REQ - NULL\n"); hci_patch_send(HCI_EVENT_PATCHES_BOOTLOAD_REQ, tSLInformation.pucTxCommandBuffer, 0, 0); break; } @@ -222,12 +225,15 @@ unsigned long retValue32; unsigned char * RecvParams; unsigned char *RetParams; +// unsigned long tout_cnt = 0; while (1) { if (tSLInformation.usEventOrDataReceived != 0) { pucReceivedData = (tSLInformation.pucReceivedData); -//printf("pucReceivedData : %04X\n",*pucReceivedData); +// ----------------------------- if((*((char *)(pucReceivedData) + HCI_EVENT_HEADER_SIZE)) == HCI_EVENT_PATCHES_FW_REQ) +// ----------------------------- printf("%02X\n",tSLInformation.usEventOrDataReceived); +// ----------------------------- printf("pucReceivedData : %04X\n",*pucReceivedData); if (*pucReceivedData == HCI_TYPE_EVNT) { @@ -411,8 +417,8 @@ } } -//printf(" REO : %04X\n",usReceivedEventOpcode); -//printf("RxREO : %04X\n",tSLInformation.usRxEventOpcode); +// ----------------------------- printf(" REO : %04X\n",usReceivedEventOpcode); +// ----------------------------- printf("RxREO : %04X\n",tSLInformation.usRxEventOpcode); if (usReceivedEventOpcode == tSLInformation.usRxEventOpcode) { @@ -446,29 +452,60 @@ // Since we are going to TX - we need to handle this event after the ResumeSPi since we need interrupts if ((*pucReceivedData == HCI_TYPE_EVNT) && (usReceivedEventOpcode == HCI_EVNT_PATCHES_REQ)) { +// ----------------------------- printf("HUHPR\n"); + hci_unsol_handle_patch_request((char *)pucReceivedData); +//int we = wlan_en; +//int wc = wlan_cs; +//int wi = tSLInformation.ReadWlanInterruptPin(); //wlan_int +//printf("%02X %02X %02X\n",we, wc, wi); +//printf("%02X %02X \n",tSLInformation.usRxEventOpcode,tSLInformation.usRxDataPending); } +//if((*((char *)(pucReceivedData) + HCI_EVENT_HEADER_SIZE)) == HCI_EVENT_PATCHES_FW_REQ) +//printf("%02X\n",tSLInformation.usEventOrDataReceived); +//printf("%02X %02X\n",tSLInformation.usRxEventOpcode,tSLInformation.usRxDataPending); +//Re-enable printf in IRQ +//tSLInformation.usEventOrDataReceived is at least once = 1 for all previous calls, why not for HCI_EVENT_PATCHES_FW_REQ? +//compare with original code (uVision - add printfs in evnt_handler and try to find out where/how tSLInformation.usEventOrDataReceived is modified) +//call hci_unsolicited_event_handler in hci_unsol_handle_patch_request?? +//try no-systick modifs in Jim's V3.1?? +//Is the latest original TI code working?? if ((tSLInformation.usRxEventOpcode == 0) && (tSLInformation.usRxDataPending == 0)) { +// ----------------------------- printf("EXIT\n"); return NULL; } +/* +//Check if interrupts are still active : +//When we enable this code, an interrupt is detected - read back = R 10 : 02 00 FF 00 00 00 00 00 00 00 +// should be = R 10 : 02 00 00 00 05 04 00 40 01 00 +//Perhaps the last write (HCI_EVENT_PATCHES_FW_REQ) was incorrect? +if(((*((char *)(pucReceivedData) + HCI_EVENT_HEADER_SIZE)) == HCI_EVENT_PATCHES_FW_REQ) && (wlan_cs == 1)) +{ +wlan_cs = 0; +}*/ } -/*if(*((char *)(pucReceivedData) + HCI_EVENT_HEADER_SIZE) == HCI_EVENT_PATCHES_FW_REQ) +//if(*((char *)(pucReceivedData) + HCI_EVENT_HEADER_SIZE) == HCI_EVENT_PATCHES_FW_REQ) && () +/*tout_cnt++; +if(((*((char *)(pucReceivedData) + HCI_EVENT_HEADER_SIZE)) == HCI_EVENT_PATCHES_FW_REQ) && (tout_cnt > 25000000)) { printf("ERROR\n"); - int wli = wlan_int; + int we = wlan_en; + int wc = wlan_cs; + int wi = tSLInformation.ReadWlanInterruptPin(); //wlan_int printf("tSLInformation.usRxEventOpcode : %04X\n",tSLInformation.usRxEventOpcode); printf("tSLInformation.usRxDataPending : %u\n",tSLInformation.usRxDataPending); - printf("WLAN int pin : %u\n",wli); + printf("WLAN int pin : %u\n",wi); + printf("WLAN en pin : %u\n",we); + printf("WLAN cs pin : %u\n",wc); + printf("*(pucReceivedData + HCI_EVENT_HEADER_SIZE) : %04X\n",*(pucReceivedData + HCI_EVENT_HEADER_SIZE)); + printf("usReceivedEventOpcode : %04X\n",usReceivedEventOpcode); + printf("pucReceivedData : %04X\n",*pucReceivedData); printf("HCI_EVENT_HEADER_SIZE : %02X\n",HCI_EVENT_HEADER_SIZE); printf("HCI_EVENT_PATCHES_FW_REQ : %02X\n",HCI_EVENT_PATCHES_FW_REQ); printf("HCI_TYPE_EVNT : %02X\n",HCI_TYPE_EVNT); printf("HCI_EVNT_PATCHES_REQ : %02X\n\n",HCI_EVNT_PATCHES_REQ); - - printf("*(pucReceivedData + HCI_EVENT_HEADER_SIZE) : %04X\n",*(pucReceivedData + HCI_EVENT_HEADER_SIZE)); - printf("usReceivedEventOpcode : %04X\n",usReceivedEventOpcode); - printf("pucReceivedData : %04X\n",*pucReceivedData); while(1){} }*/ //printf("."); @@ -627,7 +664,7 @@ { unsigned long res = 0; unsigned char *pucReceivedData; - +// ----------------------------- printf("UEH\n"); if (tSLInformation.usEventOrDataReceived != 0) { pucReceivedData = (tSLInformation.pucReceivedData); @@ -771,11 +808,12 @@ void SimpleLinkWaitEvent(unsigned short usOpcode, void *pRetParams) { +//printf("SLWE-I\n"); // In the blocking implementation the control to caller will be returned only // after the end of current transaction tSLInformation.usRxEventOpcode = usOpcode; hci_event_handler(pRetParams, 0, 0); -//printf("SLWE EXIT\n"); +//printf("SLWE-E\n"); } //***************************************************************************** @@ -812,3 +850,4 @@ +
--- a/hci.cpp Mon Jul 08 13:18:12 2013 +0000 +++ b/hci.cpp Sat Jul 13 13:12:46 2013 +0000 @@ -68,7 +68,7 @@ UINT8_TO_STREAM(stream, ucArgsLength); //Update the opcode of the event we will be waiting for SpiWrite(pucBuff, ucArgsLength + SIMPLE_LINK_HCI_CMND_HEADER_SIZE); - +//printf("HCS-E\n"); return(0); } @@ -164,7 +164,6 @@ unsigned char *data_ptr = (pucBuff + SPI_HEADER_SIZE); unsigned short usTransLength; unsigned char *stream = (pucBuff + SPI_HEADER_SIZE); - UINT8_TO_STREAM(stream, HCI_TYPE_PATCH); UINT8_TO_STREAM(stream, ucOpcode); stream = UINT16_TO_STREAM(stream, usDataLength + SIMPLE_LINK_HCI_PATCH_HEADER_SIZE); @@ -174,6 +173,7 @@ stream = UINT16_TO_STREAM(stream, usDataLength); memcpy((pucBuff + SPI_HEADER_SIZE) + HCI_PATCH_HEADER_SIZE, patch, usDataLength); // Update the opcode of the event we will be waiting for +//printf("HPS0\n"); SpiWrite(pucBuff, usDataLength + HCI_PATCH_HEADER_SIZE); } else @@ -187,6 +187,7 @@ patch += SL_PATCH_PORTION_SIZE; // Update the opcode of the event we will be waiting for +//printf("HPS1\n"); SpiWrite(pucBuff, SL_PATCH_PORTION_SIZE + HCI_PATCH_HEADER_SIZE); while (usDataLength) @@ -222,3 +223,4 @@ //***************************************************************************** +
--- a/nvmem.cpp Mon Jul 08 13:18:12 2013 +0000 +++ b/nvmem.cpp Sat Jul 13 13:12:46 2013 +0000 @@ -77,8 +77,7 @@ //! //***************************************************************************** -signed long -nvmem_read(unsigned long ulFileId, unsigned long ulLength, unsigned long ulOffset, unsigned char *buff) +signed long nvmem_read(unsigned long ulFileId, unsigned long ulLength, unsigned long ulOffset, unsigned char *buff) { unsigned char ucStatus = 0xFF; unsigned char *ptr; @@ -129,9 +128,7 @@ //! //***************************************************************************** -signed long -nvmem_write(unsigned long ulFileId, unsigned long ulLength, unsigned long - ulEntryOffset, unsigned char *buff) +signed long nvmem_write(unsigned long ulFileId, unsigned long ulLength, unsigned long ulEntryOffset, unsigned char *buff) { long iRes; unsigned char *ptr; @@ -237,7 +234,7 @@ if (spLength != 0) { - // if reached here, a reminder is left + // if reached here, a remainder is left status = nvmem_write(ulFileId, spLength, offset, spDataPtr); }
--- a/wlan.cpp Mon Jul 08 13:18:12 2013 +0000 +++ b/wlan.cpp Sat Jul 13 13:12:46 2013 +0000 @@ -116,7 +116,9 @@ // IRQ Line asserted - send HCI_CMND_SIMPLE_LINK_START to CC3000 hci_command_send(HCI_CMND_SIMPLE_LINK_START, ptr, WLAN_SL_INIT_START_PARAMS_LEN); +//printf("HCS-E\n"); SimpleLinkWaitEvent(HCI_CMND_SIMPLE_LINK_START, 0); +//printf("SLWE-E\n"); } @@ -264,22 +266,32 @@ // init spi SpiOpen(SpiReceiveHandler); - // Check the IRQ line ulSpiIRQState = tSLInformation.ReadWlanInterruptPin(); // ASIC 1273 chip enable: toggle WLAN EN line tSLInformation.WriteWlanPin( WLAN_ENABLE ); - + if (ulSpiIRQState) { // wait till the IRQ line goes low while(tSLInformation.ReadWlanInterruptPin() != 0) { + // Code inserted to avoid a wait forever. This only happens when wlan_start(0) is called. + // We need to reassert the enable pin to get an IRQ acknowledge from the CC3000. + // The real cause is unknown. + // A test indicates the enable pin only needs to be reasserted once. + if(usPatchesAvailableAtHost == 0) + { + tSLInformation.WriteWlanPin( WLAN_DISABLE ); + wait_ms(50); + tSLInformation.WriteWlanPin( WLAN_ENABLE ); + wait(1.5); + } } } else { - // wait till the IRQ line goes high and than low + // wait till the IRQ line goes high and then low while(tSLInformation.ReadWlanInterruptPin() == 0) { } @@ -291,7 +303,9 @@ // Read Buffer's size and finish hci_command_send(HCI_CMND_READ_BUFFER_SIZE, tSLInformation.pucTxCommandBuffer, 0); +//printf("HCS-E %02X\n",IRQ_cnt); SimpleLinkWaitEvent(HCI_CMND_READ_BUFFER_SIZE, 0); +//printf("SLWE-E\n"); }