Communication SPI et I2C?

Forum de support pour les locuteurs de la langue française qui souhaitent écrire dans leur langue maternelle.

Moderator: Benj

Post Reply
tech
Posts: 353
Joined: Tue Sep 23, 2008 9:39 am
Been thanked: 9 times
Contact:

Communication SPI et I2C?

Post by tech »

Bonjour,

Voici mon problème, j’utilise un PIC18F4550 et j’ai fait un programme pour recevoir du RF par nRF24L01 et j’utilise un Real Time Clock DS1307 en même temps pour afficher l’horloge. Le problème c’est que ça ne fonctionne pas les deux en même temps dans le même programme?

J’ai fait deux programmes séparer pour voir si le RTC fonctionnait et j’ai fait la même chose pour le nRF24L01 et tous les deux fonctionne très bien!

Es que c’est possible que la communication SPI ne peux fonctionner en même temps que le I2C? :?

Merci

Chris

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Communication SPI et I2C?

Post by Benj »

Bonjour Chris,

Sur l'appareil 18F4550, les SPI et I2C utilisent le même périphérique MSSP et vous ne pouvez utiliser l'un ou l'autre qu'en mode matériel.

Vous pouvez probablement contourner le problème en initialisant le composant SPI, puis en exécutant les opérations SPI, puis en initialisant I2C, puis en exécutant les opérations I2C et en répétant.

Je conseillerais néanmoins de déplacer I2C ou SPI vers un canal logiciel et différentes broches E / S, ce qui devrait résoudre le problème pour vous.


Hello Chris,

On the 18F4550 device the SPI and I2C use the same MSSP peripheral and so you can only use one or the other in hardware mode.

You can probably work around the problem by initialising the SPI component and then performing SPI operations and then initialising the I2C and then performing I2C operations and repeating.

I would however advise moving either the I2C or SPI to a software channel and different I/O pins and this should solve the problem for you.

tech
Posts: 353
Joined: Tue Sep 23, 2008 9:39 am
Been thanked: 9 times
Contact:

Re: Communication SPI et I2C?

Post by tech »

Bonjour Benj,

Merci pour les informations, je voudrais savoir si je peux utiliser en même temps la communication SPI et RS232 ou si les SPI et RS232 utilisent le même périphérique MSSP ?

Merci

Chris

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Communication SPI et I2C?

Post by Benj »

Salut chris,

Le RS232 ou UART utilise un périphérique UART complètement différent du périphérique MSSP. Il ne devrait pas y avoir de problème en utilisant SPI et RS232 en même temps.


Hi Chris,

The RS232 or UART uses a UART peripheral which is completely different from the MSSP peripheral. There should be no problems using SPI and RS232 at the same time.

Post Reply