Différences entre versions de « Bluefruit-LE-Shield-Configuration »

De MCHobby - Wiki
Sauter à la navigation Sauter à la recherche
(Page créée avec « {{Bluefruit-LE-Shield-NAV}} {{traduction}} == Attention == {{ambox-stop|text=Before you start uploading any of the example sketches, you'll need to CONFIGURE the Bluefru... »)
 
 
(5 versions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
 
{{Bluefruit-LE-Shield-NAV}}
 
{{Bluefruit-LE-Shield-NAV}}
 
{{traduction}}
 
  
 
== Attention ==
 
== Attention ==
{{ambox-stop|text=Before you start uploading any of the example sketches, you'll need to CONFIGURE the Bluefruit interface - there's a lot of options so pay close attention! }}
+
{{ambox-stop|text=Avant de téléverser les croquis/sketchs d'exemple sur votre Arduino, vous aurez besoin de CONFIGURER l'interface du Bluefruit interface - soyez attentif car il y a de nombreuses options! }}
  
 
== Quelle carte avez-vous? ==
 
== Quelle carte avez-vous? ==
There's a few products under the Bluefruit name:
+
Il y a plusieurs produits sous le nom Bluefruit.
 +
 
 +
Nous allons présenter ces produits et leur type d'interface dans la liste ci-dessous.
 +
 
 +
<small>Toutes les images ci-dessous sont créditées à [http://www.adafruit.com Adafruit Industries] - All the images here under are credited to [http://www.adafruit.com Adafruit Industries].</small>
 +
{{asm-begin}}
 +
 
 +
{{asm-row|img=Bluefruit-LE-Shield-Configuration-10.jpg}}
 +
{{asm-text}} Si vous utilisez un Shield Bluefruit LE alors vous disposer d'un module '''NRF51822 connecté en SPI'''. Vous pouvez l'utiliser avec un '''Atmega328''' (Arduino UNO ou compatible), '''ATmega32u4''' (Arduino Leonardo, compatible) ou '''ATSAMD21''' (Arduino Zero, compatible). Et éventuellement d'autres plateformes.
 +
 
 +
Your pinouts are '''Hardware SPI''', CS = '''8''', IRQ = '''7''', RST = '''4'''
 +
 
 +
{{asm-row|img=Bluefruit-LE-Shield-Configuration-11.jpg}}
 +
{{asm-text}} '''Bluefruit Micro ou Feather 32u4 Bluefruit'''
 +
 
 +
Si vous disposez d'un Bluefruit Micro ou Feather 32u4 Bluefruit LE alors vous disposez d'un ATmega32u4 avec un bus '''SPI matériel''', CS = '''8''', IRQ = '''7''', RST = '''4'''
 +
 
 +
 
 +
{{asm-row|img=Bluefruit-LE-Shield-Configuration-12.jpg}}
 +
{{asm-text}} '''Feather M0 Bluefruit LE'''
 +
 
 +
Si vous disposez d'un Feather M0 Bluefruit LE alors vous avez un microcontrôleur ATSAMD21 avec un bus '''SPI matériel''', CS = '''8''', IRQ = '''7''', RST = '''4'''
 +
 
 +
 
 +
{{asm-row|img=Bluefruit-LE-Shield-Configuration-13.jpg}}
 +
{{asm-text}} '''Bluefruit LE SPI Friend'''
 +
 
 +
Si vous disposez d'un module Bluefruit seul alors vous avez un peu plus de flexibilité avec vos raccordements. Adafruit recommande l'utilisation du bus '''SPI matériel''', CS = '''8''', IRQ = '''7''', RST = '''4'''
 +
 
 +
Vous pouvez utiliser ce module avec n'importe quel microcontrôleur disposant de 5 ou 6 broches (attention que dans ce cas, il vous faudra créer votre propre bibliothèque).
 +
 
 +
{{asm-row|img=Bluefruit-LE-Shield-Configuration-14.jpg}}
 +
{{asm-img|img=Bluefruit-LE-Shield-Configuration-15.jpg}}
 +
{{asm-text}} '''Bluefruit LE UART Friend -ou- Flora BLE'''
 +
 
 +
Si vous disposez d'un module Bluefruit LE UART vous avez également quelques flexibilités pour faire vis raccordements. Adafruit recommande l'utilisation '''d'un UART matériel''' si cela est possible. Si vous ne disposez pas d'un port UART matériel alors préférable d'utiliser le broche de contrôle de flux '''CTS'''. Ce module propose également une broche '''MODE'''.
 +
 
 +
Vous pouvez utiliser ce module avec n'importe quel microcontrôleur avec seulement 3 broches -mais le mieux reste encore d'utiliser un bus série/UART matériel!
 +
 
 +
Attention: sur une plateforme NON Arduino, il sera nécessaire de créer votre propre bibliothèque.
 +
 
 +
{{asm-end}}
 +
 
 +
== Configurer les broches utilisées ==
 +
You'll want to check the Bluefruit Config to set up the pins you'll be using for UART or SPI
 +
 
 +
Each example sketch has a secondary tab with configuration details. You'll want to edit and save the sketch to your own documents folder once set up.
 +
 
 +
{{ADFImage|Bluefruit-LE-Shield-Configuration-20.png}}
 +
 
 +
=== Paramètres généraux ===
 +
You can set up how much RAM to set aside for a communication buffer and whether you want to have full debug output. Debug output is 'noisy' on the serial console but is handy since you can see all communication between the micro and the BLE
 +
 
 +
<syntaxhighlight lang="c">
 +
// ----------------------------------------------------------------------------------------------
 +
// These settings are used in both SW UART, HW UART and SPI mode
 +
// ----------------------------------------------------------------------------------------------
 +
#define BUFSIZE                        128  // Size of the read buffer for incoming data
 +
#define VERBOSE_MODE                  true  // If set to 'true' enables debug output
 +
</syntaxhighlight>
 +
 
 +
=== UART logiciel ===
 +
If you are using Software UART, you can set up which pins are going to be used for RX, TX, and CTS flow control. Some microcontrollers are limited on which pins can be used! Check the SoftwareSerial library documentation for more details
 +
 
 +
<syntaxhighlight lang="c">
 +
// SOFTWARE UART SETTINGS
 +
#define BLUEFRUIT_SWUART_RXD_PIN      9    // Required for software serial!
 +
#define BLUEFRUIT_SWUART_TXD_PIN      10  // Required for software serial!
 +
#define BLUEFRUIT_UART_CTS_PIN        11  // Required for software serial!
 +
#define BLUEFRUIT_UART_RTS_PIN        -1  // Optional, set to -1 if unused
 +
</syntaxhighlight>
 +
 
 +
=== UART Matériel ===
 +
If you have Hardware Serial, there's a 'name' for it, usually Serial1 - you can set that up here:
 +
 
 +
<syntaxhighlight lang="c">
 +
// HARDWARE UART SETTINGS
 +
#ifdef Serial1    // this makes it not complain on compilation if there's no Serial1
 +
  #define BLUEFRUIT_HWSERIAL_NAME      Serial1
 +
#endif
 +
</syntaxhighlight>
 +
 
 +
=== La broche MODE ===
 +
For both hardware and software serial, you will likely want to define the MODE pin. There's a few sketches that dont use it, instead depending on commands to set/unset the mode. Its best to use the MODE pin if you have a GPIO to spare!
 +
 
 +
<syntaxhighlight lang="c">
 +
#define BLUEFRUIT_UART_MODE_PIN        12    // Set to -1 if unused
 +
</syntaxhighlight>
 +
 
 +
=== Broches SPI ===
 +
For both Hardware and Software SPI, you'll want to set the '''CS''' (chip select) line, '''IRQ''' (interrupt request) line and if you have a pin to spare, '''RST''' (Reset)
 +
 
 +
<syntaxhighlight lang="c">
 +
// SHARED SPI SETTINGS
 +
#define BLUEFRUIT_SPI_CS              8
 +
#define BLUEFRUIT_SPI_IRQ              7
 +
#define BLUEFRUIT_SPI_RST              4    // Optional but recommended, set to -1 if unused
 +
</syntaxhighlight>
 +
 
 +
=== Broches SPI logiciel ===
 +
If you don't have a hardware SPI port available, you can use any three pins...its a tad slower but very flexible
 +
 
 +
<syntaxhighlight lang="c">
 +
// SOFTWARE SPI SETTINGS
 +
#define BLUEFRUIT_SPI_SCK              13
 +
#define BLUEFRUIT_SPI_MISO            12
 +
#define BLUEFRUIT_SPI_MOSI            11
 +
</syntaxhighlight>
 +
 
 +
{{ambox|text=Refer to the table above to determine whether you have SPI or UART controlled Bluefruits!}}
 +
 
 +
== Sélectionner le Bus Série ==
 +
Once you've configured your pin setup in the BluefruitConfig.h file, you can now check and adapt the example sketch.
 +
 
 +
The Adafruit_BluefruitLE_nRF51 library supports four different serial bus options, depending on the HW you are using: '''SPI''' both hardware and software type, and '''UART''' both hardware and software type.
 +
 
 +
=== Carte de type UART (Bluefruit LE UART Friend & Flora BLE) ===
 +
This is for Bluefruit LE UART Friend & Flora BLE boards. You can use either software serial or hardware serial. Hardware serial is higher quality, and less risky with respect to losing data. However, you may not have hardware serial available! Software serial does work just fine with flow-control and we do have that available at the cost of a single GPIO pin.
 +
 
 +
For software serial (Arduino Uno, Adafruit Metro) you should uncomment the software serial contructor below, and make sure the other three options (hardware serial & SPI) are commented out.
 +
 
 +
<syntaxhighlight lang="c">
 +
// Create the bluefruit object, either software serial...uncomment these lines
 +
SoftwareSerial bluefruitSS = SoftwareSerial(BLUEFRUIT_SWUART_TXD_PIN, BLUEFRUIT_SWUART_RXD_PIN);
 +
 
 +
Adafruit_BluefruitLE_UART ble(bluefruitSS, BLUEFRUIT_UART_MODE_PIN,
 +
                      BLUEFRUIT_UART_CTS_PIN, BLUEFRUIT_UART_RTS_PIN);
 +
</syntaxhighlight>
 +
 
 +
For boards that require hardware serial (Adafruit Flora, etc.), uncomment the hardware serial constructor, and make sure the other three options are commented out
 +
 
 +
<syntaxhighlight lang="c">
 +
/* ...or hardware serial, which does not need the RTS/CTS pins. Uncomment this line */
 +
Adafruit_BluefruitLE_UART ble(BLUEFRUIT_HWSERIAL_NAME, BLUEFRUIT_UART_MODE_PIN);
 +
</syntaxhighlight>
 +
 
 +
=== Carte de type SPI (Bluefruit LE SPI Friend) ===
 +
For SPI based boards, you should uncomment the hardware SPI constructor below, making sure the other constructors are commented out:
 +
 
 +
<syntaxhighlight lang="c">
 +
/* ...hardware SPI, using SCK/MOSI/MISO hardware SPI pins and then user selected CS/IRQ/RST */
 +
Adafruit_BluefruitLE_SPI ble(BLUEFRUIT_SPI_CS, BLUEFRUIT_SPI_IRQ, BLUEFRUIT_SPI_RST);
 +
</syntaxhighlight>
  
 +
If for some reason you can't use HW SPI, you can switch to software mode to bit-bang the SPI transfers via the following constructor:
  
 +
<syntaxhighlight lang="c">
 +
/* ...software SPI, using SCK/MOSI/MISO user-defined SPI pins and then user selected CS/IRQ/RST */
 +
Adafruit_BluefruitLE_SPI ble(BLUEFRUIT_SPI_SCK, BLUEFRUIT_SPI_MISO,
 +
                            BLUEFRUIT_SPI_MOSI, BLUEFRUIT_SPI_CS,
 +
                            BLUEFRUIT_SPI_IRQ, BLUEFRUIT_SPI_RST);
 +
</syntaxhighlight>
  
 
{{Bluefruit-LE-Shield-TRAILER}}
 
{{Bluefruit-LE-Shield-TRAILER}}

Version actuelle datée du 26 mai 2017 à 07:55


MCHobby investit du temps et de l'argent dans la réalisation de traduction et/ou documentation. C'est un travail long et fastidieux réalisé dans l'esprit Open-Source... donc gratuit et librement accessible.
SI vous aimez nos traductions et documentations ALORS aidez nous à en produire plus en achetant vos produits chez MCHobby.

Attention

Quelle carte avez-vous?

Il y a plusieurs produits sous le nom Bluefruit.

Nous allons présenter ces produits et leur type d'interface dans la liste ci-dessous.

Toutes les images ci-dessous sont créditées à Adafruit Industries - All the images here under are credited to Adafruit Industries.

Bluefruit-LE-Shield-Configuration-10.jpg Si vous utilisez un Shield Bluefruit LE alors vous disposer d'un module NRF51822 connecté en SPI. Vous pouvez l'utiliser avec un Atmega328 (Arduino UNO ou compatible), ATmega32u4 (Arduino Leonardo, compatible) ou ATSAMD21 (Arduino Zero, compatible). Et éventuellement d'autres plateformes.

Your pinouts are Hardware SPI, CS = 8, IRQ = 7, RST = 4

Bluefruit-LE-Shield-Configuration-11.jpg Bluefruit Micro ou Feather 32u4 Bluefruit

Si vous disposez d'un Bluefruit Micro ou Feather 32u4 Bluefruit LE alors vous disposez d'un ATmega32u4 avec un bus SPI matériel, CS = 8, IRQ = 7, RST = 4


Bluefruit-LE-Shield-Configuration-12.jpg Feather M0 Bluefruit LE

Si vous disposez d'un Feather M0 Bluefruit LE alors vous avez un microcontrôleur ATSAMD21 avec un bus SPI matériel, CS = 8, IRQ = 7, RST = 4


Bluefruit-LE-Shield-Configuration-13.jpg Bluefruit LE SPI Friend

Si vous disposez d'un module Bluefruit seul alors vous avez un peu plus de flexibilité avec vos raccordements. Adafruit recommande l'utilisation du bus SPI matériel, CS = 8, IRQ = 7, RST = 4

Vous pouvez utiliser ce module avec n'importe quel microcontrôleur disposant de 5 ou 6 broches (attention que dans ce cas, il vous faudra créer votre propre bibliothèque).

Bluefruit-LE-Shield-Configuration-14.jpg


Bluefruit-LE-Shield-Configuration-15.jpg

Bluefruit LE UART Friend -ou- Flora BLE

Si vous disposez d'un module Bluefruit LE UART vous avez également quelques flexibilités pour faire vis raccordements. Adafruit recommande l'utilisation d'un UART matériel si cela est possible. Si vous ne disposez pas d'un port UART matériel alors préférable d'utiliser le broche de contrôle de flux CTS. Ce module propose également une broche MODE.

Vous pouvez utiliser ce module avec n'importe quel microcontrôleur avec seulement 3 broches -mais le mieux reste encore d'utiliser un bus série/UART matériel!

Attention: sur une plateforme NON Arduino, il sera nécessaire de créer votre propre bibliothèque.

Configurer les broches utilisées

You'll want to check the Bluefruit Config to set up the pins you'll be using for UART or SPI

Each example sketch has a secondary tab with configuration details. You'll want to edit and save the sketch to your own documents folder once set up.

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

Paramètres généraux

You can set up how much RAM to set aside for a communication buffer and whether you want to have full debug output. Debug output is 'noisy' on the serial console but is handy since you can see all communication between the micro and the BLE

// ----------------------------------------------------------------------------------------------
// These settings are used in both SW UART, HW UART and SPI mode
// ----------------------------------------------------------------------------------------------
#define BUFSIZE                        128   // Size of the read buffer for incoming data
#define VERBOSE_MODE                   true  // If set to 'true' enables debug output

UART logiciel

If you are using Software UART, you can set up which pins are going to be used for RX, TX, and CTS flow control. Some microcontrollers are limited on which pins can be used! Check the SoftwareSerial library documentation for more details

// SOFTWARE UART SETTINGS
#define BLUEFRUIT_SWUART_RXD_PIN       9    // Required for software serial!
#define BLUEFRUIT_SWUART_TXD_PIN       10   // Required for software serial!
#define BLUEFRUIT_UART_CTS_PIN         11   // Required for software serial!
#define BLUEFRUIT_UART_RTS_PIN         -1   // Optional, set to -1 if unused

UART Matériel

If you have Hardware Serial, there's a 'name' for it, usually Serial1 - you can set that up here:

// HARDWARE UART SETTINGS
#ifdef Serial1    // this makes it not complain on compilation if there's no Serial1
  #define BLUEFRUIT_HWSERIAL_NAME      Serial1
#endif

La broche MODE

For both hardware and software serial, you will likely want to define the MODE pin. There's a few sketches that dont use it, instead depending on commands to set/unset the mode. Its best to use the MODE pin if you have a GPIO to spare!

#define BLUEFRUIT_UART_MODE_PIN        12    // Set to -1 if unused

Broches SPI

For both Hardware and Software SPI, you'll want to set the CS (chip select) line, IRQ (interrupt request) line and if you have a pin to spare, RST (Reset)

// SHARED SPI SETTINGS
#define BLUEFRUIT_SPI_CS               8
#define BLUEFRUIT_SPI_IRQ              7
#define BLUEFRUIT_SPI_RST              4    // Optional but recommended, set to -1 if unused

Broches SPI logiciel

If you don't have a hardware SPI port available, you can use any three pins...its a tad slower but very flexible

// SOFTWARE SPI SETTINGS
#define BLUEFRUIT_SPI_SCK              13
#define BLUEFRUIT_SPI_MISO             12
#define BLUEFRUIT_SPI_MOSI             11

Sélectionner le Bus Série

Once you've configured your pin setup in the BluefruitConfig.h file, you can now check and adapt the example sketch.

The Adafruit_BluefruitLE_nRF51 library supports four different serial bus options, depending on the HW you are using: SPI both hardware and software type, and UART both hardware and software type.

Carte de type UART (Bluefruit LE UART Friend & Flora BLE)

This is for Bluefruit LE UART Friend & Flora BLE boards. You can use either software serial or hardware serial. Hardware serial is higher quality, and less risky with respect to losing data. However, you may not have hardware serial available! Software serial does work just fine with flow-control and we do have that available at the cost of a single GPIO pin.

For software serial (Arduino Uno, Adafruit Metro) you should uncomment the software serial contructor below, and make sure the other three options (hardware serial & SPI) are commented out.

// Create the bluefruit object, either software serial...uncomment these lines
SoftwareSerial bluefruitSS = SoftwareSerial(BLUEFRUIT_SWUART_TXD_PIN, BLUEFRUIT_SWUART_RXD_PIN);

Adafruit_BluefruitLE_UART ble(bluefruitSS, BLUEFRUIT_UART_MODE_PIN,
                      BLUEFRUIT_UART_CTS_PIN, BLUEFRUIT_UART_RTS_PIN);

For boards that require hardware serial (Adafruit Flora, etc.), uncomment the hardware serial constructor, and make sure the other three options are commented out

/* ...or hardware serial, which does not need the RTS/CTS pins. Uncomment this line */
Adafruit_BluefruitLE_UART ble(BLUEFRUIT_HWSERIAL_NAME, BLUEFRUIT_UART_MODE_PIN);

Carte de type SPI (Bluefruit LE SPI Friend)

For SPI based boards, you should uncomment the hardware SPI constructor below, making sure the other constructors are commented out:

/* ...hardware SPI, using SCK/MOSI/MISO hardware SPI pins and then user selected CS/IRQ/RST */
Adafruit_BluefruitLE_SPI ble(BLUEFRUIT_SPI_CS, BLUEFRUIT_SPI_IRQ, BLUEFRUIT_SPI_RST);

If for some reason you can't use HW SPI, you can switch to software mode to bit-bang the SPI transfers via the following constructor:

/* ...software SPI, using SCK/MOSI/MISO user-defined SPI pins and then user selected CS/IRQ/RST */
Adafruit_BluefruitLE_SPI ble(BLUEFRUIT_SPI_SCK, BLUEFRUIT_SPI_MISO,
                             BLUEFRUIT_SPI_MOSI, BLUEFRUIT_SPI_CS,
                             BLUEFRUIT_SPI_IRQ, BLUEFRUIT_SPI_RST);

Basé sur "Bluefruit LE Shield" d'Adafruit Industries, écrit par Kevin Townsend - Traduit en Français par shop.mchobby.be CC-BY-SA pour la traduction
Toute copie doit contenir ce crédit, lien vers cette page et la section "crédit de traduction".

Based on "Bluefruit LE Shield" from Adafruit Industries, written by Kevin Townsend - Translated to French by shop.mchobby.be CC-BY-SA for the translation
Copies must includes this credit, link to this page and the section "crédit de traduction" (translation credit).

Traduit avec l'autorisation d'AdaFruit Industries - Translated with the permission from Adafruit Industries - www.adafruit.com