Open Makuna opened 9 years ago
It would have been so much simpler if you would have posted the source code as well =)
Updated with source code. The code was basically the server test sketch included in the project modified to my Wifi settings.
The issue maybe that interrupts are being missed due to how much work is being done within the interrupt service routine. The Adafruit code does polling of the interrupt pin/state to work around it (which seems hacky). The only reason an interrupt would be missed is that the source didn't hold it long enough (?) or interrupts were disabled when it did trigger. I suspect the latter due to how much is within it.
Thanks for your report. It's strange that it's failing as early as the DHCP, though I've never tried tinyhci with a Mega2560 before.
Regarding the interrupt possibility, the CC3K shouldn't be able to raise another interrupt until we release the CS line in hci_end_receive(), after handling the first one. That's the last thing we do in our interrupt handler. Perhaps my assumption about the SPI protocol is wrong, but I'm not sure how anything could work robustly if that weren't true.
Does it make any difference if you disable serial logging? That code adds quite a bit of time to the ISR.
Removing the debugging doesn't help.
I glanced around and noticed some comments about must delay by micro seconds but the were delaying by milliseconds. I changed those also and that didn't help.
Does the sketch look correct? what do you run on?
My CC3000 is the latest firmware, I am using the latest Arduino IDE 1.6. I am running on a Mega2560. My setup works fine with Adafruit library.
This is connecting to a secured wifi.
I changed the EN pin to 5 (what my hardware is setup for) and I never get a DHCP address.
wlan_ioctl_set_connection_policy retuns zero wlan_connect returns zero
but the event callback that sets wifi_dhcp to 1 never happens. I turned on level 2 debug, see dump below
Source Code:
Bebug Dump: