为什么 X-NUCLEO-BNRG2A1 (BlueNRG-M2SP) 和 Nucleo-G070RB 之间的 UART 通信不起作用?

Why is my UART communication between X-NUCLEO-BNRG2A1 (BlueNRG-M2SP) and Nucleo-G070RB not working?

提问人:Max Pach 提问时间:11/15/2023 最后编辑:Max Pach 更新时间:11/23/2023 访问量:29

问:

我目前在嵌入 BlueNRG-M2(本身嵌入 BlueNRG-2)的 X-NUCLEO-BNRG2A1 扩展板和我的 Nucleo-G070RB 之间进行简单的 UART 通信(+ 基于 HCI 命令的协议)时遇到了问题。我不能为此使用 SPI。

我还创建了一个 ST 主题

首先,在 X-NUCLEO-BNRG2A1 侧 (BlueNRG-2):

  • 我下载了固件包 STSW-BNRG2N-V320
  • 我使用了文档UM2666“STM32Cube的X-CUBE-BLE2低功耗蓝牙软件扩展入门”作为支持,
  • 我使用 BlueNRG-2_2 Flasher Utility (STSW-BNRGFLASHER) 和 STSW-BNRG2N-V320 刷新了 X-NUCLEO-BNRG2A1,即嵌入式 BlueNRG-2,以便使用 BlueNRG-2N 对其进行模拟 -我从SPI和不必要的线路中删除了所有电阻器/跳线:(SPI_MOSI R80 & SPI_MISO R79 ), (SPI_CSN R77), (SPI_IRQ / BOOT R85 & R82) , (SPI_CS R70, R76 & R86), (GPIO R81 & R84), (跳线 J11, J12, J13, J14, J15 (我对 J15 有疑问,但我认为这只是闪烁时需要的))
  • 我添加了所有必需的 0 欧姆电阻器 + 跳线:用于 DIO12 的 R83(BlueNRG-2N 上的 SEL 引脚)和跳线 J10(3v3 <-> VDD)。
  • 我还添加了 0 欧姆电阻 R71 和 R73,因为我最初认为这 2 条线(DIO4 和 5)是 UART 线。但是,如果我理解正确的话,这些只是用于使用时的应用串行通信,BlueNRG-2N的仿真使用DIO8和DIO11作为UART引脚。

然后,在 NUCLEO-G070RB 侧 (STM32G0xx):

  • 我有一个已经正常工作的项目在这个板上正常运行
  • 我以以下项目为例:STM32L - 从 BlueNRG-1_2 DK 3.2.3 BLE_Beacon_NWK,并使用 doxygen 文档中的文档“STM32L - BlueNRG-1,2 网络协处理器(UART 模式)”作为支持。
  • 我使用导入库中定义的 HCI 命令使 UART Rx/Tx 模块正常工作。此模块在以下情况下正常工作:
    • TX,因为我在笔记本电脑上使用 USB 转串口转换器使用 python 脚本使用 hci lib 对其进行了验证:数据已正确发送。
    • RX,因为如果我在同一个UART上使环路TX<->RX,我就会收到发送的内容。我还没有测试过 HCI 事件数据的接收情况,但这不是这里的 pb。

最后,我像这样映射/配置/检查了 GPIO/总线:

  • BlueNRG-M2SP 引脚 1 和 2 原封不动
  • BlueNRG-M2SP 引脚 3 = DIO4 = ?< --- > STM32G0xx PA9 = 未使用和浮动
  • BlueNRG-M2SP 引脚 4 = DIO5 = ?< --- > STM32G0xx PA10 = 未使用和浮动
  • BlueNRG-M2SP 引脚 5 = VDD 在 3V3 时相对应
  • BlueNRG-M2SP 引脚 6 和 7 未触及
  • BlueNRG-M2SP 引脚 8 正确接地
  • BlueNRG-M2SP 引脚 9 原封不动
  • 编辑“BlueNRG-M2SP 引脚 11 = DIO11 = UART_RXD (BNRG-2N) ” < --- > STM32G0xx PB2 = USART3_TX。
    • 当未连接且 BlueNRG-M2SP 处于正确状态时,引脚相对浮动
    • 连接+USB串口转换RX线连接时,HCI数据良好(由py python解释)
  • 编辑“BlueNRG-M2SP 引脚 10 = DIO8 = UART_TXD (BNRG-2N) ” < --- > STM32G0xx PB0 = USART3_RX
    • 当未连接且 BlueNRG-M2SP 处于正确状态时,引脚在 3V3 时相对应,当 BlueNRG-M2SP 处于复位状态时降至悬空状态
    • 当连接到 USB 串行转换器或示波器 NOTHING 的 RX 线时,保持在 3v3
  • BlueNRG-M2SP 引脚 12 至 18 未触及
  • BlueNRG-M2SP 引脚 19 = RESETN < --- > STM32G0xx PA8 = GPO 设置为 1,当想要启用 BRNG 时。在通信过程中正确设置为 1
  • BlueNRG-M2SP 引脚 19 = DIO12 = SEL (BNRG-2N) < --- > STM32G0xx PB4 = GPO 设置为 1,当想要启用 UART 时。在通信过程中正确设置为 1

因此,BlueNRG-M2SP应该像BlueNRG-2N一样工作:通电并接地,启用(resetn = 1)和UART的SEL引脚= 1,映射了UART TX和RX,并接收到良好的HCI命令,但没有响应,我的应用程序命令全部超时。

I tried swapping RX & TX just in case, nothing either.

Have I missed something ? Like the DIO 4 & 5 are maybe the ones to use ? The "emulation" FW is not UART HCI protocol compatible ?

I really appreciate any response, I am a bit in a pickle here ... ‌🙄‌

Max.Pach

STM32 串口 HCI 蓝牙

评论

0赞 Ilya 11/16/2023
Have you verified that the microcontroller UART works correctly for both sending and receiving arbitrary data? Can you scope/use logic analyzer to see if your software fails to see the data, or no data is actually physically sent over the line? Additionally, try to use the slave device with PC's UART (via USB/UART bridge), you can use something like Yat (on Windows) to send and receive raw binary data. Basically, test every component of software and hardware individually first, see what you can learn from it.
0赞 Max Pach 11/23/2023
Hi Ilya I did all of the scoping / verification on the MCU TX line, and on MCU RX line (BlueNRG TX) nothing at all. The only thing that happen is the level going up when I reset the BlueNRG, then going back to 0V, stable. My app & my µcontroller are not the issue here, as I tested to loop TX & RX on it: I receive all the sent bytes in the low level UART RX functions. Then, what does the App with it afterwards will be another problem, I need first to establish this comm with the BlueNRG.
0赞 Max Pach 11/23/2023
I also sent using minicom and a USB to UART bridge the exact same HCI frame that is first sent in my App : [ 0x01 0x0f 0xfc 0x02 0x01 0x07 ], using the func aci_hal_set_tx_power_level(). Ofc the BlueNRG was in a live state (RESTN to 1 and DIO12 to 1). No response after a few attempts, nothing on the BlueNRG TX line. So far, I am 99% sure that I do something wrong with the BlueNRG itself: either the FW inside isn't working as I intend or I missed a step.
0赞 Max Pach 11/23/2023
I also used a steval-idb008v2 Eval Board. I isolated the BlueNRG-2 on it from the Main MCU & sensors & level shifter & SPI switch. I Flashed it with different FW, including the STSW-BNRG2N-V320 and the DTM UART, same result. However I noticed something weird: the TX pin of the BlueNRG-2 is low and the RX is high when unconnected.

答:

0赞 Max Pach 12/5/2023 #1

Copied reply from ST community:

Nevermind, seems to come from the way you flash the BlueNRG board ...

I was using the X-NUCLEO-BNRG2A1 & the STEVAL-IDB008V2. Using the latter, I of course made the HW workarounds to enable external com without having the embedded components in the way.

Using RF Flasher and a bunch of different Example apps (DTM Uart, Beacon, the BlueNRG 2N "emulation"), no response, on both boards.

  • SWD only for X-NUCLEO-BNRG2A1
  • SWD & UART with STEVAL-IDB008V2 (as there is a USB to serial converter STM32 on the board that manages that flashing function). No response with GUI either.

Using the BlueNRG DK graphical app, I managed to flash through UART the STEVAL-IDB008V2 with a DTM Uart image that now communicates with Both GUI & my FW on external Nucleo-G070RB. Howerver, when I compare the flash with the DTM Uart image using RF Flasher, there are differences.

I am really confused with that. This should not happen. Flashing the device with an example bin from the BlueNRG DK folders through RF Flasher should work. Now I am stuck with the X-NUCLEO-BNRG2A1 not working as there is no way to program it using the BlueNRG DK graphical app.

So what I am missing there ? I will try on Ubuntu using OpenOCD but I fear the same result will happen.