[Tinyos-devel] Re: I2C and SPI sharing
Max CORTIANA
max.cortiana at st.com
Thu Oct 12 10:18:18 PDT 2006
I'm changing CC2420TrasmitP.nc
setModeSpi is called before getting the signal SpiResource.granted() in CC2420.
I've not updated CVS in the last weeks, I could also try this way.
SpiByte.write() fails when the radio gets access to SPI with Resource.request() instead of Resource.immediateRequest(), i.e. when the resource is busy with I2C.
If Resource.immediateRequest is substituted with Resource.request, it works fine if no I2C transmission is going on.
I'll try to reproduce the problem with minimal code and I'll send over here.
- Max
> Where are you making this change?
> It looks like it's either a problem with configuring the SPI or the
> arbiter, which signals events to configure the SPI.
> Just to confirm, are you seeing that exact order of events with
> setModeSpi() occurring between 2 and 3? If so, it's probably not the
> arbiter itself.
> The code to configure/unconfigure the SPI has also changed somewhat
> recently. Though I don't see anything obious in the code. Vlado or
> Philipp, do you have any ideas?
> A few additional questions:
> - Does SpiByte.write() always fail after using the I2C for the first
> time? Or after some number of I2C request()/release() cycles?
> - Does it still fail if you simply request()/release() the I2C
> resource but don't actually send any I2C packets in between?
> - Can you send minimal code that reproduces the problem?
Max Cortiana wrote:
> Yes, it is called.
>
> I've made some tests.
> If instead of calling Resource.Request() i do
>
> ...
> //call Resource.Request()
> post loop();
>
> task void loop(){
> if (call Resource.ImmediateRequest() != SUCCESS)
> post loop();
> }
>
> it works fine. Obviously it's a computation waste.
>
> - Max
>
>
>
>> Sounds like the USART is not being configured properly, especially
>> since SpiByte.write() is not returning. Do you know if
>> HplMsp430Usart.setModeSpi() is getting called between steps 2 and 3?
>
>
> Max Cortiana wrote:
>> Woops..
>>
>> I'm using TinyOs 2.x
>>
>> - Max
>>
>>
>> Max Cortiana wrote:
>>> Hi
>>>
>>> I'm working on TeosB and I have a problem when sharing I2C and SPI,
>>> used by the cc2420 Radio.
>>> The channel is shared correctly until SPI tries to access the
>>> channel while the channel is busy with I2C.
>>> I see the following steps are:
>>>
>>> 1. Resorce is requested by SPI.
>>> 2. I2C finishes its operations and releases the shared resource
>>> (MSP430UsartShare0) ;
>>> 3. SPI receives the granted event.
>>> 4. Radio tries to send a byte through SPI
>>> 5. The byte isn't sent.
>>> 6. SPI loops inside a while, waiting for an interrupt which will
>>> never arrive. 7. Since a task i locked in an infinite loop,
>>> the mote is like dead.
>>>
>>>
>>> Any suggestion?
>>>
>>> Thanks
>>> - Max
>>>
>>>
>>>
>>
>>
>
>
More information about the Tinyos-devel
mailing list