Jump to content
  • 0

Pmod BLE <->STM32F103 connection and communication problem


jimmycheung_lufes

Question

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

Hi @jimmycheung_lufes,

Welcome to the forums. In our adruino demo for the Pmod BLE on the resource center here only uses the serial pins so I belie you would only need the rx and tx connected correctly. Also Its been awhile since I used uart through an interrupt. But as far as I can tell your code look ok. I would also suggest using the Arduino demo to verify you have everything connected correctly and use the PMod BLE without interrupts first.

cheers,

Jon

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...