1 / 56

SPI - Serial Peripheral Interface

SPI - Serial Peripheral Interface. Pour aller lire le CAN et écrire dans le CNA. Schéma bloc. Chronogrammes. Mode 0. Mode 1. Chronogrammes. Mode 2. Mode 3. Chronogramme d’une transaction. Chronogramme d’une transaction. Registre des modes du SPI. Exemple initialisation du SPI.

una
Télécharger la présentation

SPI - Serial Peripheral Interface

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SPI - Serial Peripheral Interface Pour aller lire le CAN et écrire dans le CNA

  2. Schéma bloc

  3. Chronogrammes Mode 0 Mode 1

  4. Chronogrammes Mode 2 Mode 3

  5. Chronogramme d’une transaction

  6. Chronogramme d’une transaction

  7. Registre des modes du SPI

  8. Exemple initialisation du SPI

  9. Exemple initialisation du SPI

  10. Configuration du SPI • 1) Associer les broches au SPI: • Exemple SPI #1: • PIO_Configure(pinsSPI1, PIO_LISTSIZE(pinsSPI1));

  11. Configuration du SPI • 2) Configuration des registres SPI_CR et SPI_MR: • Structure: • config = (AT91C_SPI_DLYBCS & (0 << 24)) | • (AT91C_SPI_PCS & (0xE << 16)) | • (AT91C_SPI_LLB & (0 << 7)) | • (AT91C_SPI_MODFDIS & (1 << 4)) | • (AT91C_SPI_PCSDEC & (0 << 2)) | • (AT91C_SPI_PS & (1 << 1)) | • (AT91C_SPI_MSTR & (1 << 0)); • SPI_Configure(AT91C_BASE_SPI1, AT91C_ID_SPI1, config);

  12. Configuration du SPI • 2) Configuration des registres SPI_CR et SPI_MR : • Structure: • config = (AT91C_SPI_DLYBCS & (0 << 24)) | • (AT91C_SPI_PCS & (0xE << 16)) | • (AT91C_SPI_LLB & (0 << 7)) | • (AT91C_SPI_MODFDIS & (1 << 4)) | • (AT91C_SPI_PCSDEC & (0 << 2)) | • (AT91C_SPI_PS & (1 << 1)) | • (AT91C_SPI_MSTR & (1 << 0)); • SPI_Configure(AT91C_BASE_SPI1, AT91C_ID_SPI1, config); Délais entre « chip select » « Chip select » périphérique « Local loopback » Détection de fautes Décodage périphérique Sélection périphérique comm. Maitre ou esclave

  13. Configuration du SPI • 2) Configuration du registre SPI_CSR3: • Structure: • config = (AT91C_SPI_DLYBCT & (0x01 << 24)) | • (AT91C_SPI_DLYBS & (0x01 << 16)) | • (AT91C_SPI_SCBR & (0x10 << 8)) | • (AT91C_SPI_BITS & (AT91C_SPI_BITS_16)) | • (AT91C_SPI_CSAAT & (0x0 << 3)) | • (AT91C_SPI_NCPHA & (0x0 << 1)) | • (AT91C_SPI_CPOL & (0x1 << 0)); • SPI_ConfigureNPCS(AT91C_BASE_SPI1, 3, config);

  14. Configuration du SPI • 2) Configuration du registre SPI_CSR3 : • Structure: • config = (AT91C_SPI_DLYBCT & (0x01 << 24)) | • (AT91C_SPI_DLYBS & (0x01 << 16)) | • (AT91C_SPI_SCBR & (0x10 << 8)) | • (AT91C_SPI_BITS & (AT91C_SPI_BITS_16)) | • (AT91C_SPI_CSAAT & (0x0 << 3)) | • (AT91C_SPI_NCPHA & (0x0 << 1)) | • (AT91C_SPI_CPOL & (0x1 << 0)); • SPI_ConfigureNPCS(AT91C_BASE_SPI1, 3, config); Délai entre 2 transactions Délai avant SPCK Vitesse communication Taille du transfert (16 bits) Chip select actif après trans. ? Phase de l’horloge Polarité de l’horloge du SPI CNA

  15. Configuration du SPI • 2b) Configuration du registre SPI_CSR2 : • … • SPI_ConfigureNPCS(AT91C_BASE_SPI1, 2, config); • 3) Activation du SPI: • Directement (pour le SPI #1): • SPI_Enable(AT91C_BASE_SPI1); • Tout cela peut se regrouper dans une fonction que nous pouvons nommer: • voidinitSPI(void){ • … • } CAN

  16. MAX5322Convertisseur numérique analogique

  17. Montage de laboratoire

  18. MAX5322 – Schéma bloc

  19. CNA MAX5322 – Conversion R-2R

  20. Tensions en sortie

  21. Configuration du CNA

  22. Configuration broches MAX5322 Déclaration variables SetupDAC() Board.h

  23. Suite Broche LDAC mise à 1 Broche CLR mise à 1 Broche UNI/BIP A mise à 0 Broche UNI/BIP B mise à 1 Broche SHDN mise à 1

  24. Transactions du SPI avec le CNA • Initialisation du CNA • SPI_Write(AT91C_BASE_SPI1, 3, 0xE000); • SPI_Read(AT91C_BASE_SPI1); • Wait(1000); • SPI_Write(AT91C_BASE_SPI1, 3, (0x4000 | 0x07FF)); • SPI_Read(AT91C_BASE_SPI1); Activations des canaux du CNA 0 volt Canal A – DAC_OUT

  25. Transactions du SPI avec le CNA • Initialisation du CNA • SPI_Write(AT91C_BASE_SPI1, 3, 0xE000); • SPI_Read(AT91C_BASE_SPI1); • Wait(1000); • SPI_Write(AT91C_BASE_SPI1, 3, (0x4000 | 0x07FF)); • SPI_Read(AT91C_BASE_SPI1); • SPI_Write(AT91C_BASE_SPI1, 3, (0x5000 | 0x0000)); • SPI_Read(AT91C_BASE_SPI1); Activations des canaux du CNA 0 volt Canal A – DAC_OUT 0 volt Canal B - VSHIFT

  26. MAX1270Convertisseur analogique numérique

  27. Montage de laboratoire

  28. MAX1270 – Schéma de la puce

  29. MAX1270 – Schéma bloc interne

  30. CAN MAX1270

More Related