SPI on dsPic30F2010

Create new topics, add your comment, remark, bugs...
frouby
Posts: 4
Joined: Fri May 27, 2011 4:54 pm

SPI on dsPic30F2010

Postby frouby » Fri May 27, 2011 5:13 pm

Hi there!

I've got some problems on a SPI communication between a 33FJ128GP802 (master) and a µ-gyro ADIS16100 (slave) and a 30F2010 (slave) . Here is the configuration parameters :
Master 33FJ128GP802 : SPI config block
Mode:Master
Clock 625000Hz
Starting : Enable
SDO Enable
Data length 16bits
Sample phase : End of bit
Clock Active State : High
Output change on transition : Active to Idle
I use the SPI I/O Interrupt driven block with the mode 'read once - interrupt re-enable after block execution'. I try to send 2 trames to the gyro and 3 trames to the 30F2010. I expect to receive 5 trames too. I've also configured the the chip select of each slave in the block.

Slave 30F2010 SPI config block
Mode:Slave
Clock : 625000Hz
Starting : Enable
SDO Enable
Data length: 16 bits
Slave Select PIN enable (slave mode)
Sample phase : End of bit
Clock active state : high
Output change on transition : Active to Idle

Here is the configuration of the SPI I/O Interrupt driven of the 30F2010: mode : continuous run - Interrupt always enable. If I change the mode to 'read once - interrupt re-enable after block execution' the dspic does not boot after programmation. I don't have selected a chip enable because it's already configured previously on the SPI Config block.

My problem is that with this configuration the 30F2010 always send some datas on his SDO even when his chip select is at an high level. So that, it makes a conflict with SDO of the µgyro.

I've also noticed that the trames of the SDO are not in the good order.

frouby
Posts: 4
Joined: Fri May 27, 2011 4:54 pm

Re: SPI on dsPic30F2010

Postby frouby » Fri May 27, 2011 7:24 pm

I think I iderstood what was my real problem. It's that my 30F2010 doesn't boot if I change the mode to 'read once - interrupt-enable after block execution'. Sometimes it boots and it works well but mostly it doesn't boot....any ideas for this bug? Does it happen to anyone? thanks to reply!! :)

frouby
Posts: 4
Joined: Fri May 27, 2011 4:54 pm

Re: SPI on dsPic30F2010

Postby frouby » Mon Jun 06, 2011 9:40 pm

I know the origins of the problem!! At the boot of the unit, after 5-6 seconds, the bit SPI1STAT.SPIROV is set because of the overflow in the SPI1BUF that makes the dsPic crash. To avoid the crash, I just have to put the SPI1STATbits.SPIROV=0 at the beginning of the SPI Interrupt function. But during 700ms every 6 seconds, I have no data on the SPI network...How can I fix this problem ??


Return to “General Remark and Questions”

Who is online

Users browsing this forum: No registered users and 1 guest