[Tinyos-devel] Is there anything wrong inMsp430SpiNoDmaP.nc?
tom
skyyellow at 163.com
Wed May 16 02:01:11 PDT 2007
hi all:
I am a student study in UESTC in china.When we use the telosb node in tinyos2.0(msp430F1611+cc2420),we found that there may be something wrong in function continueOp() which locate in chips/msp430/usart/Msp430SpiNoDmaP.nc.It can't generate interrupt and signal UsartInterrupts.rxDone after write the last byte.
So I modify the code in continuOp() and UsartInterrupts.rxDone as follows
in continuOp()
atomic {
call Usart.tx( m_tx_buf ? m_tx_buf[ m_pos ] : 0 );
end = m_pos + SPI_ATOMIC_SIZE;
if ( end > m_len )
end = m_len;
while ( ++m_pos < end ) {
while( !call Usart.isTxIntrPending() );
call Usart.tx( m_tx_buf ? m_tx_buf[ m_pos ] : 0 );
while( !call Usart.isRxIntrPending() );
tmp = call Usart.rx();
if ( m_rx_buf )
m_rx_buf[ m_pos - 1 ] = tmp;
}
}
change to-->
atomic {
end = m_pos + SPI_ATOMIC_SIZE;
if ( end > m_len )
end = m_len;
while ( m_pos < end-1 ) {
call Usart.tx( m_tx_buf ? m_tx_buf[ m_pos ] : 0 );
while( !call Usart.isRxIntrPending() );
tmp = call Usart.rx();
if ( m_rx_buf )
m_rx_buf[ m_pos ] = tmp;
m_pos++;
}
call Usart.tx( m_tx_buf ? m_tx_buf[ m_pos++ ] : 0 );
}
and in UsartInterrupts.rxDone
if ( m_rx_buf )
m_rx_buf[ m_pos-1 ] = data;
change to-->
if ( m_rx_buf )
m_rx_buf[ m_pos++ ] = data;
after doing this It worked,So is there really anything wrong in Msp430SpiNoDmaP.nc or I lose something?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.millennium.berkeley.edu/pipermail/tinyos-devel/attachments/20070516/f77915da/attachment.htm
More information about the Tinyos-devel
mailing list