cancel
Showing results for 
Search instead for 
Did you mean: 

_SPI_Reset on STM32l475(hci_init(0,0)  if (hciContext.io.Reset) hciContext.io.Reset();

mrabti
Associate II

Edit by ST Moderator: This post has been translated from French to comply with the ST Community Terms and Conditions (§10.2). The original can be found below.

Hello everyone, I hope all is well. I'm trying to learn how to use the STM32 by creating a personal project, and I'm stuck on the Bluetooth part. I've watched videos, read documentation, etc., and I can't see where I'm going wrong. I've been making mistakes for just over a month now. Sorry for the long post.

Card: L475EIOT01A2

Software pack: X-CUBE-BLE with NOT SELECTED
I have created an
app_bluenrg.c


Bonjour à tous, j'espère que tout va bien. J'essaie d'apprendre à utiliser le STM32 en créant un projet personnel, et je suis bloqué sur la partie Bluetooth. J'ai regardé des vidéos, lu de la documentation, etc., et je ne vois pas où je me trompe. Cela fait un peu plus d'un mois que je suis en train de faire des erreurs. Désolé pour ce long message.

Carte : L475EIOT01A2

Pack logiciel : X-CUBE-BLE avec NON SÉLECTIONNÉ
j'ai créé un
app_bluenrg.c 

#include <app_bluenrg.c> #include "bluenrg_conf.h" #include "bluenrg1_types.h" #include "bluenrg1_gap.h" #include "bluenrg1_aci.h" #include "bluenrg1_hci_le.h" #include "stdio.h" #include "stdlib.h" #define bdaddre_size 6 uint8_t SERVER_BDARR[]={0x01,0x02,0x03,0x04,0x05,0x6}; void bluenrg_init(void) { const char *name ="Trix"; tBleStatus ret; uint8_t bdaddre[bdaddre_size]; BLUENRG_memcpy(bdaddre,SERVER_BDARR,sizeof(SERVER_BDARR)); uint16_t service_handle, dev_name_char_handle,appearance_char_handle; /* * 1.Initialize HCI * 2.Reset HCI * 3.Configure Device address * 4.Initialize GATT server * 5.Initialize GAP service * 6.Update characteristics * 7.Add custom service * */ /*1.*/ hci_init(0,0); hci_reset(); HAL_Delay(100); ret=aci_hal_write_config_data(CONFIG_DATA_PUBADDR_OFFSET,CONFIG_DATA_PUBADDR_LEN, bdaddre); if(ret !=BLE_STATUS_SUCCESS){printf("aci_hal_write_config_data failed \r\n");} ret=aci_gatt_init(); if(ret !=BLE_STATUS_SUCCESS){printf("aci_gatt_init failed \r\n");} ret=aci_gap_init(GAP_PERIPHERAL_ROLE,0,0x07,&service_handle,&dev_name_char_handle,&appearance_char_handle); if(ret !=BLE_STATUS_SUCCESS){printf("aci_gap_init failed \r\n");} ret=aci_gatt_update_char_value(service_handle, dev_name_char_handle, 0, strlen(name), (uint8_t*)name); if(ret !=BLE_STATUS_SUCCESS){printf("aci_gatt_update_char_value failed \r\n");} //add custom service //ret = add_simple_service(); //if(ret !=BLE_STATUS_SUCCESS){printf("add_simple_service failed \r\n");} } void bluenrg_process(void) { tBleStatus ret; uint8_t local_name[]={AD_TYPE_COMPLETE_LOCAL_NAME,'B','L','E','-','G','-','U','P'}; ret=aci_gap_set_discoverable(ADV_IND, 0, 0, PUBLIC_ADDR, NO_WHITE_LIST_USE, sizeof(local_name), local_name, 0, NULL, 0, 0); //if(ret !=BLE_STATUS_SUCCESS){printf("aci_gap_set_discoverable failed \r\n");} }
View more

I have the pins correctly matched according to the document ‘Getting started with the STMicroelectronics X-CUBE-BLE2 software package for STM32CubeMX’. They are as follows:

PB7/6 = USART1_TX/RX respectively

PC12/11/10 = SPI3_SCK/MISO/MOSI respectively

 

As I said, I've been working on this for a month and sometimes I get a different error, but I'm back to the original error. This is when initialising MX_BlueNRG_MS_Init();

In hci_tl.c, at this party


J'ai les broches correctement appariées selon le document « Démarrage avec le progiciel STMicroelectronics X-CUBE-BLE2 pour STM32CubeMX ». Elles sont les suivantes :

PB7/6 = USART1_TX/RX respectivement

PC12/11/10 = SPI3_SCK/MISO/MOSI respectivement

 

Comme je l'ai dit, cela fait un mois que je travaille là-dessus et parfois, je rencontre une erreur différente, mais je suis revenu à l'erreur initiale. C'est lors de l'initialisation de MX_BlueNRG_MS_Init();

Dans hci_tl.c, à cette fête

/* Initialiser le pilote de bas niveau */ 
 si (hciContext.io.Init) hciContext.io.Init(NULL); 
 si (hciContext.io.Reset) hciContext.io.Reset();

 

0 REPLIES 0