version_2.0

Dependents:   cc3000_ping_demo_try_2

Fork of cc3000_hostdriver_mbedsocket by Martin Kojtal

Files at this revision

API Documentation at this revision

Comitter:
erezi
Date:
Wed Jun 25 06:08:39 2014 +0000
Parent:
46:ca8c234997c0
Commit message:
version_2.0

Changed in this revision

cc3000.cpp Show annotated file Show diff for this revision Revisions of this file
cc3000_wlan.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/cc3000.cpp	Sun Nov 10 21:41:44 2013 +0100
+++ b/cc3000.cpp	Wed Jun 25 06:08:39 2014 +0000
@@ -82,7 +82,9 @@
 static char networkmask[17] = "\0";
 
 void cc3000::init() {
+    printf("CC3000 init start. \r\n");
     _wlan.start(0);
+    printf("CC3000 init 1. \r\n");
 
     uint32_t subnet[4] = {0};
     uint32_t ip[4] = {0};
@@ -90,12 +92,18 @@
     uint32_t dns[4] = {0};
 
     _netapp.dhcp(ip, subnet, getway, dns);
+    printf("CC3000 init 2. \r\n");
     _wlan.stop();
+    printf("CC3000 init 3. \r\n");
     wait(1);
+    printf("CC3000 init 4. \r\n");
     _wlan.start(0);
+    printf("CC3000 init 5. \r\n");
 
     _status.enabled = 1;
     _wlan.set_event_mask(HCI_EVNT_WLAN_UNSOL_INIT | HCI_EVNT_WLAN_KEEPALIVE);
+    printf("CC3000 init 6. \r\n");
+    printf("CC3000 init done. \r\n");
 }
 
 void cc3000::init(const char *ip, const char *mask, const char *gateway) {
@@ -366,9 +374,12 @@
 }
 
 void cc3000::start(uint8_t patch) {
+    printf("CC3000 start 1. \r\n");
     _wlan.start(patch);
+    printf("CC3000 start 2. \r\n");
     _status.enabled = 1;
     _wlan.set_event_mask(HCI_EVNT_WLAN_UNSOL_INIT | HCI_EVNT_WLAN_KEEPALIVE);
+    printf("CC3000 start 3. \r\n");
 }
 
 void cc3000::stop(void) {
--- a/cc3000_wlan.cpp	Sun Nov 10 21:41:44 2013 +0100
+++ b/cc3000_wlan.cpp	Wed Jun 25 06:08:39 2014 +0000
@@ -67,38 +67,68 @@
 
 void cc3000_wlan::start(uint16_t patches_available_host) {
     uint32_t spi_irq_state;
+    DigitalIn input_irq(D3);    //P21 input from button
 
+    printf("CC3000 wlan start 1. \r\n");
     _simple_link.set_sent_packets(0);
+    printf("CC3000 wlan start 2. \r\n");
     _simple_link.set_number_of_released_packets(0);
+    printf("CC3000 wlan start 3. \r\n");
     _simple_link.set_op_code(0);
+    printf("CC3000 wlan start 4. \r\n");
     _simple_link.set_number_free_buffers(0);
+    printf("CC3000 wlan start 5. \r\n");
     _simple_link.set_buffer_length(0);
+    printf("CC3000 wlan start 6. \r\n");
     _simple_link.set_buffer_size(0);
+    printf("CC3000 wlan start 7. \r\n");
     _simple_link.set_pending_data(0);
+    printf("CC3000 wlan start 8. \r\n");
     _simple_link.set_transmit_error(0);
+    printf("CC3000 wlan start 9. \r\n");
     _simple_link.set_data_received_flag(0);
+    printf("CC3000 wlan start 10. \r\n");
     _simple_link.set_buffer_size(0);
+    printf("CC3000 wlan start 11. \r\n");
 
     // init spi
     _spi.open();
+    printf("CC3000 wlan start 12. \r\n");
     // Check the IRQ line
     spi_irq_state = _spi.wlan_irq_read();
+    printf("CC3000 wlan start 13. input_irq = %d \r\n",input_irq.read());
     // ASIC 1273 chip enable: toggle WLAN EN line
     _spi.set_wlan_en(WLAN_ENABLE);
+    printf("CC3000 wlan start 14. input_irq = %d \r\n",input_irq.read());
 
     if (spi_irq_state) {
         // wait till the IRQ line goes low
-        while(_spi.wlan_irq_read() != 0);
+        printf("CC3000 wlan start 15 before wait to irq. \r\n");
+        while(_spi.wlan_irq_read() != 0){
+            printf("CC3000 wlan start 15 in while. input_irq = %d\r\n",input_irq.read());
+            wait(0.2);
+            }
+        printf("CC3000 wlan start 15. \r\n");
     } else {
         // wait till the IRQ line goes high and then low
-        while(_spi.wlan_irq_read() == 0);
+        printf("CC3000 wlan start 16 before wait to irq. input_irq = %d\r\n",input_irq.read());
+        while(_spi.wlan_irq_read() == 0){
+            printf("CC3000 wlan start 16 in while. input_irq = %d\r\n",input_irq.read());
+            wait(0.2);
+            }
+        printf("CC3000 wlan start 16. \r\n");
         while(_spi.wlan_irq_read() != 0);
+        printf("CC3000 wlan start 17. \r\n");
     }
+    printf("CC3000 wlan start 18. \r\n");
     simpleLink_init_start(patches_available_host);
+    printf("CC3000 wlan start 19. \r\n");
 
     // Read Buffer's size and finish
     _hci.command_send(HCI_CMND_READ_BUFFER_SIZE, _simple_link.get_transmit_buffer(), 0);
+    printf("CC3000 wlan start 20. \r\n");
     _event.simplelink_wait_event(HCI_CMND_READ_BUFFER_SIZE, 0);
+    printf("CC3000 wlan start 21. \r\n");
 }