cc3000/RFM12B board sharing ISP, different SS - conflict?

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
sketchy
 
Posts: 285
Joined: Thu Jun 28, 2012 11:37 pm

cc3000/RFM12B board sharing ISP, different SS - conflict?

Post by sketchy »

As soon as cc3000.begin() is called, data between a JeeNode (from JeeLabs - has an RFM12B module from Hope) and my Arduino + cc3000 + RFM12B board is not "heard."

Both boards use SPI (sharing pins 13,12,11). Both cc3000 and RFM12B run their sketches fine when sharing SPI. There appears to be a conflict in communication (over SPI) when APIs for both are called within the same sketch.

- the cc3000 uses:
- pin 8 for SS/CSN
- pin 3 for IRQ
- pin 5 for VBAT
- the RFM12B uses:
- pin 10 for SS/CSN
- pin 2 for IRQ

I'll keep digging. In the meantime, would you happen to know where to look to resolve this?

Thank you for any help.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: cc3000/RFM12B board sharing ISP, different SS - conflict

Post by adafruit_support_rick »

Try calling cc3000.begin before you initialize the RFM12B.

User avatar
sketchy
 
Posts: 285
Joined: Thu Jun 28, 2012 11:37 pm

Re: cc3000/RFM12B board sharing ISP, different SS - conflict

Post by sketchy »

Thanks Rick.
I tried you suggestion. No change.

What were your thoughts when you suggested?

Any other thoughts greatly appreciated. Perhaps it is the speeds of the SPI bus? One wants one speed the other another? I am fairly n00b to SPI but guessing. Perhaps there is an interrupt conflict on incoming data? They are assigned different interrupts - but would one of the RF components decide to clobber other interrupts? I know adafruit does not have anything to do with the rfm12b libraries/hw - but on the cc3000 side - are there places in the library or spec i should be looking closely at? It will take me awhile to bumble my way through the library source so i was hoping you could give me a jump start since you have the context / details of the library and hw of cc3000 breakout board.

again, thank you.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: cc3000/RFM12B board sharing ISP, different SS - conflict

Post by adafruit_support_rick »

I'm thinking that it's a conflict between the drivers regarding the state of the SPI control register (SPCR). The CC3000 library is careful to preserve and restore the state of SPCR whenever a function makes changes. Perhaps the RFM12B driver is not so careful?

My suggestion was based on an observation that the CC3000 library doesn't always preserve SPCR properly in begin() - at least, that was the situation a couple of months ago. To my knowledge, it preserves SPCR properly everywhere else.

You might want to look at the RFM12B library code to see what it does with SPCR.

User avatar
sketchy
 
Posts: 285
Joined: Thu Jun 28, 2012 11:37 pm

Re: cc3000/RFM12B board sharing ISP, different SS - conflict

Post by sketchy »

Thanks Rick. I will! Can you please ask Kevin if he has seen this before? Since he wrote this stuff...I can understand if that is not possible.

User avatar
ktownsend
 
Posts: 1447
Joined: Thu Nov 05, 2009 2:18 am

Re: cc3000/RFM12B board sharing ISP, different SS - conflict

Post by ktownsend »

I really don't know what this could be off the top of my head.

The TI modules do use a less common SPI mode (most devices use Mode 0). Alternatively, perhaps when the interrupt fires on the TI the CS lines on the TI side asserts at the same time that the CS line on the other module is asserted, so both devices are listening and everything goes off into the weeds?

The best solution would be to hook up a logic analyzer if you have one (Saleae Logic, etc.) and see if both CS lines at some point are asserted, just as somewhere to start?

Kevin

User avatar
sketchy
 
Posts: 285
Joined: Thu Jun 28, 2012 11:37 pm

Re: cc3000/RFM12B board sharing ISP, different SS - conflict

Post by sketchy »

Thank you. I can (conceptually) see how this could cause the conflict. I am new to electronics, so while a challenge (logic analyzer)..this is an opportunity to learn how to do this, so I'm excited to trouble shoot using this method.

HOW about deletion/screw up of incoming data - could that be a cause? e.g.: Rick noted
"
I'm thinking that it's a conflict between the drivers regarding the state of the SPI control register (SPCR). The CC3000 library is careful to preserve and restore the state of SPCR whenever a function makes changes. Perhaps the RFM12B driver is not so careful?
"

what are your thoughts on this possibility?

(my intent is to gather a "laundry list" - or perhaps better visualized as a "line up" - of potential suspects. Since I am new to hw /driver conflict trouble shooting I can then come up with steps to tackle each one. If I don't do that, I am fearful I'll get frustrated because I fall short of knowing what to do...)

any additional thoughts on trouble shooting GREATLY appreciated!!

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: cc3000/RFM12B board sharing ISP, different SS - conflict

Post by adafruit »

the breakout version of the cc3000 needs something to buffer MISO as it is not tristated

http://learn.adafruit.com/adafruit-cc30 ... onnections

you can look at the cc3000+SD example sketches for how to share the SPI lines, but no, the CC3000 does not work great with other SPI devices without a lot of care & debugging. this kind of stuff is not easy to fix, if you're "new to electronics", you may find this project challenging and we don't offer coding or library modification support and assistance.

our suggestion is to find an RF module that does not require sharing those pins.

User avatar
sketchy
 
Posts: 285
Joined: Thu Jun 28, 2012 11:37 pm

Re: cc3000/RFM12B board sharing ISP, different SS - conflict

Post by sketchy »

Good to know. On the other hand, I got to play with a logic analyzer the other day. I keep hoping challenges bring opportunities...but then experience should speak to rethinking how to get to point b (as you recommend). I'm going to debug a bit more because coming closer to why is like the anticipation that comes with looking forward to a fun event. And...I'll look at different solutions. Since I'm using this for a home hydroponics base system, I might switch to ethernet since it probably makes the most sense to plug into a home's router. Would be more robust regarding connections at least. Since the base system isn't like an Internet device that has to be in a specific spot - like an Apple TV.

I appreciate the time this team has taken to provide insight and excellent advice.

User avatar
sketchy
 
Posts: 285
Joined: Thu Jun 28, 2012 11:37 pm

Re: cc3000/RFM12B board sharing ISP, different SS - conflict

Post by sketchy »

I explored the cc3000's not sharing of the SPI bus with the RFM12B. A thread from the JeeLabs forum (RFM12B) notes (@martynj):

"The CC3000 behaviour - floating at reset time, then a permanent pull up to its Vcc after internal initialisation is reasonable. It's the [not needed words deleted] 3v 5v conversion on the breakout board.

As I mentioned, moving to a 3v only implementation removes the need for these tricky logic level conversions."

see : http://jeelabs.net/boards/6/topics/3078

(I got the Saleae logic analyzer from adafruit. What a great product. I am looking for a "similar" product for an oscilloscope).

Do you agree with martynj's assessment? What are your thoughts on "fixing" this challenge?

Thank you.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: cc3000/RFM12B board sharing ISP, different SS - conflict

Post by adafruit »

we dont carry the RFM12B and nobody on staff has every used one so we don't have any other suggestions or insight.

User avatar
sketchy
 
Posts: 285
Joined: Thu Jun 28, 2012 11:37 pm

Re: cc3000/RFM12B board sharing ISP, different SS - conflict

Post by sketchy »

OK. Thank you for your response.

User avatar
sketchy
 
Posts: 285
Joined: Thu Jun 28, 2012 11:37 pm

Re: cc3000/RFM12B board sharing ISP, different SS - conflict

Post by sketchy »

I got this to work. I did it through software (although I believe a level shifter could do the trick in a hw solution).

I ended up "wrapping" cc3000 traffic in wlan_start(0) and wlan_stop().

I detail this in a blog post I just put up (I discuss this wrapping in the last section of the post):http://bitknitting.BANNED.com/2013/1 ... ont-share/

programify
 
Posts: 1
Joined: Fri May 27, 2016 6:12 am

Re: cc3000/RFM12B board sharing ISP, different SS - conflict

Post by programify »

This was a useful page that helped confirm an idea that the RFM12B library was hogging the SPI bus on which I was also rocking two MCP3301 ADC chips.

The problem was the RFM12B was forcing the SPI bus into double speed mode by setting bit 0 in the SPSR (SPI Status Register). My work-around was to clear that bit using "SPSR &= ~(0x01) ;" before reading the MCP3301 data, and then returning to double speed mode using "SPSR |= 0x01 ;". I also set the Select line (pin 10) HIGH whilst doing that.

Now everything is working great!

I hope this helps others getting the RFM12B library to play nice with other devices on the SPI bus...

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”