Skocz do zawartości

Nucleo64 L4 + BlueNRG nawiązanie komunikacji


Pomocna odpowiedź

Napisano

Witam

Chciałbym nawiązać komunikację z tym modułem, ale zatrzymałem się na 3 pkt z dokumentacji.

1. The master puts the nCS line to low and the BlueNRG wakes up. BlueNRG is

expecting a command within 2 ms before going to sleep.

2. The master sends the header, but the BlueNRG replies with the READY byte as 0x00

or 0xFF. This means the BlueNRG SPI interface is still not initialized.

3. The master keeps polling the BlueNRG, (releasing and asserting CS again). In order to

read again the header, the SPI master has to release the CS line and assert it within

2ms from the previous CS assertion. After a while, the READY byte becomes 0x02 but

both the buffer sizes are 0x00. This means the BlueNRG SPI is initialized, but the

buffer is not yet prepared.

4. As soon as the buffer size becomes non-zero, the master can write data to the

BlueNRG.

Oto mój kod:

ble_reset(); //reset układu
HAL_Delay(1); // czekam 1ms
ble_ss_select(select_ss); // pulldown na CS
HAL_SPI_TransmitReceive(&hspi1, header_master, header_slave, HEADER_SIZE, 15); 
ble_ss_select(unselect_ss); //pullup na CS

gdy powtarzam ostanie 3 linie w while'u też nie otrzymuje odpowiedniej odpowiedzi. wartość nagłówka header_slve jaką otrzymuje to: 0x02, 0x00, 0x00, 0x00, 0x00. W przykładzie jest tak:

/* CS reset */
 HAL_GPIO_WritePin(BNRG_SPI_CS_PORT, BNRG_SPI_CS_PIN, GPIO_PIN_RESET);

 /* Exchange header */  
 HAL_SPI_TransmitReceive(&SpiHandle, header_master, header_slave, HEADER_SIZE, TIMEOUT_DURATION);

 if (spi_fix_enabled) {
   set_irq_as_input();
 }

 if (header_slave[0] == 0x02) {
   /* SPI is ready */
   if (header_slave[1] >= (Nb_bytes1+Nb_bytes2)) {
 .....

I to jakoś działa bo ich przykład się uruchamia.

Jak rozwiązać ten problem?

UM1755 User manual BlueNRG Bluetooth® LE stack application command interface (ACI)

Bądź aktywny - zaloguj się lub utwórz konto!

Tylko zarejestrowani użytkownicy mogą komentować zawartość tej strony

Utwórz konto w ~20 sekund!

Zarejestruj nowe konto, to proste!

Zarejestruj się »

Zaloguj się

Posiadasz własne konto? Użyj go!

Zaloguj się »
×
×
  • Utwórz nowe...