| Ligne 277 : |
Ligne 277 : |
| | Thanks to its high throughput, the SPI bus are used for display, data acquisition, data transmission, etc. | | Thanks to its high throughput, the SPI bus are used for display, data acquisition, data transmission, etc. |
| | | | |
| − | {{ambox|text=The Cansat RFM69 Radio module of Cansat kit do use {{fname|SPI(0)}} bus to exchange data with the MicroControler.}} | + | {{ambox|text=The Cansat RFM Radio module of Cansat kit do use {{fname|SPI(0)}} bus to exchange data with the MicroControler.}} |
| | + | |
| | + | [[Fichier:ENG-CANSAT-V2-SPI.jpg|480px]] |
| | | | |
| | SPI bus are short (below 10cm) and uses '''3 wires for the data bus + a "Slave Select" wire per device''': | | SPI bus are short (below 10cm) and uses '''3 wires for the data bus + a "Slave Select" wire per device''': |
| Ligne 286 : |
Ligne 288 : |
| | | | |
| | [[Fichier:ENG-CANSAT-PICO-HowTo-SPI.png]] | | [[Fichier:ENG-CANSAT-PICO-HowTo-SPI.png]] |
| | + | |
| | | | |
| | The following snip of code creates an instance of the {{fname|SPI(0)}} bus | | The following snip of code creates an instance of the {{fname|SPI(0)}} bus |
| Ligne 294 : |
Ligne 297 : |
| | # SPI(0) : GP4=Miso, GP5=/SS, GP6=Sck, GP7=Mosi | | # SPI(0) : GP4=Miso, GP5=/SS, GP6=Sck, GP7=Mosi |
| | # reducing clock speed to 400 KHz | | # reducing clock speed to 400 KHz |
| − | spi = SPI( 0, baudrate=400000 ) | + | spi = SPI( 0, miso=Pin(4), mosi=Pin(7), sck=Pin(6), baudrate=400000 ) |
| | </syntaxhighlight> | | </syntaxhighlight> |
| | | | |
| | {{underline|Tips & Tricks:}}<br />Under MicroPython the SS pin is not "hardware" tied to a given SPI bus. User can freely choose any pin as "Slave Select" pin. | | {{underline|Tips & Tricks:}}<br />Under MicroPython the SS pin is not "hardware" tied to a given SPI bus. User can freely choose any pin as "Slave Select" pin. |
| | + | |
| | + | Using several "Slave Select" line allows to wire several device on a single SPI bus, only one device can be active at a given time. |
| | | | |
| | == Additional tutorials == | | == Additional tutorials == |