I have a STM32F103RBT6 nucleo-64 board. Now I want to connect it with Pmod BLE unit so that STM32 board can communicate with an Android app with the BLE kit. For the STM32 board, I would like to use USART2 port for TX and RX of Pmod BLE. Therefore, I connected the RX of BLE unit to USART2 TX of STM32 board, and TX of BLE unit is connected to USART2 RX of STM32 board. However, I want to know except these two pins, Vcc and GND, is there any port(s) to connect?
Moreover, for the STM32 board programming, I would like is it enough for me to write these codes to receive and send data (a single character) between STM32 board and Pmod BLE kit?
void USART2_IRQHandler()
{
if (USART_GetITStatus (USART2,USART_IT_TC) != RESET)
{
//if something has been received, send it back and then clear "input".
if (hasInput)
{
USART_SendData(USART2,input);
input = ' ';
hasInput = false;
}
else
{
}
}
if (USART_GetITStatus(USART2,USART_IT_RXNE) != RESET)
{
//if there is something received.
input = (unsigned char) USART_ReceiveData(USART2);
hasInput = true;
}
}
Question
jimmycheung_lufes
Hello,
I have a STM32F103RBT6 nucleo-64 board. Now I want to connect it with Pmod BLE unit so that STM32 board can communicate with an Android app with the BLE kit. For the STM32 board, I would like to use USART2 port for TX and RX of Pmod BLE. Therefore, I connected the RX of BLE unit to USART2 TX of STM32 board, and TX of BLE unit is connected to USART2 RX of STM32 board. However, I want to know except these two pins, Vcc and GND, is there any port(s) to connect?
Moreover, for the STM32 board programming, I would like is it enough for me to write these codes to receive and send data (a single character) between STM32 board and Pmod BLE kit?
void USART2_IRQHandler() { if (USART_GetITStatus (USART2,USART_IT_TC) != RESET) { //if something has been received, send it back and then clear "input". if (hasInput) { USART_SendData(USART2,input); input = ' '; hasInput = false; } else { } } if (USART_GetITStatus(USART2,USART_IT_RXNE) != RESET) { //if there is something received. input = (unsigned char) USART_ReceiveData(USART2); hasInput = true; } }
Thank you.
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.