cc3000 start procedure

Posted on
  • Hi, Gordon, Hi all!
    according to the TI instructions I tryed to initialize cc3000. (i've got the module from
    embeddedadventures)
    here is the code snippet, I've used:

    SPI_OPERATION_WRITE=0x01;
    HCI_TYPE_COMMAND=0x01; 
    HCI_COMMAND_SIMPLE_LINK_START=0x4000;
    SPI1.setup();
    digitalWrite(B0,0); 		// Disable the module by setting EN(B0) low 
    while(digitalRead(C5)==0){};	// Wait for IRQ line (C5) to go high
    digitalWrite(B0,1);			// Enable the module by setting EN high 
    while(digitalRead(C5)){};	// Wait for IRQ line to go low 
    digitalWrite(C4,1); 		//Set CS line (C4) high
    temp1=2;
    while(temp1-->0){};			// Wait 50 µs (probably it takes not 50us, is it critically?)	
    SPI1.send(SPI_OPERATION_WRITE,A4);
    SPI1.send(0x00,A4);			// Send via SPI: 0x00 (length MSB)
    SPI1.send(0x05,A4);			// Send via SPI: 0x05 (length LSB)
    SPI1.send(0x00,A4);			// Send via SPI: 0x00 (busy 0)
    temp1=2;
    while(temp1-->0){};			// Wait 50 µs 	
    SPI1.send(0x00,A4);			// Send via SPI: 0x00 (busy 1)
    SPI1.send(HCI_TYPE_COMMAND,A4);
    SPI1.send(HCI_COMMAND_SIMPLE_LINK_START & 0xff); 	//Send via SPI: HCI_COMMAND_SIMPLE_LINK_START (LSB)
    SPI1.send(HCI_COMMAND_SIMPLE_LINK_START >> 8); 		//Send via SPI: HCI_COMMAND_SIMPLE_LINK_START (MSB)
    SPI1.send(0x01,A4);			// Send via SPI: 0x01 (1 byte payload)
    SPI1.send(0x01,A4);			// Send via SPI: PatchesRequest (0x00 = Don’t load patches 0x01 = Load patches) 		
    digitalWrite(C4,0); 		//Set CS line low
    while(digitalRead(C5)==1){};	// Wait for IRQ line to go low
    ans = SPI1.send(0x00,A4);
    

    monitoring "ans" variable by lcd indicator shows me always zero, but must contain the answer from the module.
    what is my mistake ?

  • Hi Andrey, One thought is that using SPI1.send(0x00,A4); will lower A4 and raise it for each byte. You may also find that the SPI 'mode' is wrong (CPOL/CPHA). You're better off doing:

    SPI1.send([SPI_OPERATION_WRITE,0x00,0x05,0x00],A4);
    

    (or actually doing the raising and lowering of A4 manually, and not specifying it for SPI.send at all)

    The code that I have been using (different pins) is:

    var EN = B7;
    var IRQ = B8;
    var CS = B6;       
    SPI1.setup({sck:B3,miso:B4, mosi:B5,mode:1/*Mode 1   CPOL= 0  CPHA= 1*/, baud: 1000000});
    
    digitalWrite(CS,1);
    digitalWrite(EN,0);
    while (!digitalRead(IRQ)); // wait for IRQ high
    digitalWrite(EN,1);  
    while (digitalRead(IRQ)); // wait for IRQ low
    
    digitalWrite(CS,1); 
    
    // 1 = command 
    SPI1.send([1,0,5,0]); 
    // IRQ goes high after this
    SPI1.send([0,1,0,0x40,1,1]); // last digit should be 1 according to EmbeddedAdventures  
    digitalWrite(CS,0); 
    

    However I haven't had much luck with the Embedded Adventures module. I'm in contact with them and hopefully we'll figure out what the problem is.

    There is CC3000 support in Espruino itself though (which works with the Adafruit module) - see http://www.espruino.com/CC3000

    Until the Espruino board comes out you'll have to compile your image with USE_CC3000=1 and USE_NET=1 in the Makefile though (I've been developing using the F4DISCOVERY board and it works well).

  • Hi, and thanks a lot for the explanations. Have I understand It correctly, that embeddedadventures module will not work with Espruino? Is their module workable in common? What the problem with It?

  • At the moment I can't get it working with Espruino, but hopefully we will sort that out soon.

    There is no reason why it shouldn't work but for some reason, even with the same firmware, the Adafruit module works and this one doesn't.

    the modules do work in other MCUs and with other software though.

  • Just to say, if you have any luck getting it going , I'd love to know.

    Given how soon I want to get the Espruino boards out, if I don't get this fixed in the next few days I will have to order the Adafruit modules.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

cc3000 start procedure

Posted by Avatar for Andrey @Andrey

Actions