5 years, 6 months ago.

Nucleo L152RE Adafruit cc3000 waiting for data loop

Hi there,

I'm having problems with this demo. The program doesn't get past wifi.init(). The call stack looks like this:

Call Stack

main() -->
- cc3000::init()   //wifi.init()
    - cc3000_wlan::set_event_mask(uint32_t mask)
       - cc3000_event::simplelink_wait_event(uint16_t op_code, void *ret_param)
         - cc3000_event::hci_event_handler(void *ret_param, uint8_t *from, uint8_t *fromlen)

In the last function call, it gets stuck in the while loop, waiting for the _data_received_flag to change:

uint8_t *cc3000_event::hci_event_handler(void *ret_param, uint8_t *from, uint8_t *fromlen) {
  while (1)
     if (_simple_link.get_data_received_flag() != 0) 


I've tried the Adafruit cc3000 wifi board with an Arduino Uno and the Adafruit cc3000 library and it works great every time. So I know the wifi board is good.

I've tried with two different Nucleo L152RE boards and different pins. Same result.

I've also tried with an external 5V power supply for the wifi board and also running on USB 3.0. So I know it's not a power issue.

I also tried not updating libraries on program import, but get the same result.

I updated the firmware on the cc3000 from v1.12 to v1.14 (which I think is the latest), and when I did, it worked a few times and then stopped working again. Which was very strange, but I can't say if it was related to the firmware update.

I haven't changed the code at all, except to add my own cc3000 object construction:

changes to main.cpp (along with .h definition of STM32_L152RE)

#define WIFI_IRQ    D3
#define WIFI_EN     D5
#define WIFI_CS     D10
#define WIFI_MOSI   D11
#define WIFI_MISO   D12
#define WIFI_CLK    D13
#elif (MY_BOARD == STM32_L152RE)
cc3000 wifi(WIFI_IRQ, WIFI_EN, WIFI_CS, SPI(WIFI_MOSI, WIFI_MISO, WIFI_CLK), "ssid", "key", WPA2, false);
Serial pc(USBTX, USBRX);

I've also tried connecting without security and on two different networks and routers.

It seems similar to problems that others have had:



Were these ever definitively resolved? Or did they just start working somehow? Should I try different code revisions?

Please help. Am I missing something? One thing is my init() in init.cpp is empty. But not sure what should be done in here for the L152RE board.

Question relating to:

I haven't tested cc300 with any nucleo target. Looks like people are having problems with nucleo boards, so might be connected to its implementation - spi , irq?

posted by Martin Kojtal 20 Jan 2015

I am having the same problem.

Did Peter Drescher code (below) worked and solved the issue???

I am working with a STMF401

posted by Cristian Fuentes 20 May 2016

1 Answer

5 years, 6 months ago.

The init with :

cc3000 wifi(PC_4, PB_1, PB_2, SPI(PB_15, PB_14, PB_13), "ssid", "key", WPA2, false);

is working on a STM F401. Can try it on a L152 tomorrow.

Accepted Answer

Code is working on L152. You can use the http://developer.mbed.org/users/SolderSplashLabs/code/WiFiDip-KitchenSink/ program to test. It will also show you the firmware version. change the pinning in wifi.cpp : cc3000 wifi(PC_4, PB_1, PB_2, SPI(PB_15, PB_14, PB_13));

and switch the serial in main : Serial pc(USBTX, USBRX);

posted by Peter Drescher 22 Jan 2015

Hi Peter, Thanks for taking the time to test it. It made me go through everything again. I re-flashed the firmware on the adafruit cc3000 and the nucleo L152 board and it seems to be working now. I even managed to connect a TFT and have output messages write to that using your excellent ILI9341 libraries. It doesn't successfully connect each time, but nor does it freeze up. It could well be something else I'm doing wrong...

While I'm here, thanks also to Martin Kojtal for a great library.

posted by John Sainsbury 25 Jan 2015

The code hits as wall at: cc3000_event::hci_event_handler(void *ret_param, uint8_t *from, uint8_t *fromlen) [same as the poster above]

Please advise.

PS: As to using WiFiDip-KitchenSink(as opposed to cc3000_hello_world_demo), to test: I am finding it hard to get the former compiled. Hence I am using the latter to do my testing.

posted by Karthik Reddy 12 Jul 2015

It is not compiling for me. pFunctionPointer_t seems to be undefined.... by the way the declaration posted in the beginning is lacking a parameter wifi(PC_4, PB_1, PB_2, SPI(PB_15, PB_14, PB_13), HERE);

Any help greatly appreciated

posted by Cristian Fuentes 23 May 2016