This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

STM32F411 to NRF51822 to Android Phone

Development Environment

S130 / SDK_12.3.0 Central Central NRF51 DONGLE

S130 / SDK_12.3.0 Central Peri NRF51822 + STM32F411

 

BUART_BAUDRATE_BAUDRATE_Baud115200

Hi, I am trying to implement BLE communication by sending STM32 data to the NRF.

I tested  STM32 UART communication to NRF51822 by Terminal Program,'Teraterm'.  and checked normal operation.

and, I tested nrf51822 and nrf51 dongle communication by Terminal Program,'Teraterm'.  and checked normal operation.

However, sending data from STM32 to NRF51 DONGLE fails.

I think I made wrong code for NRF51822. 

 

now, I am using Nrf_BLE_NUS_Services.

here is my code.

-------------------------------------------------------

uint8_t data_array[20];
data_array[0] = NRF_UART0->TXD;

....

for(;;)

{

 ble_nus_string_send(&m_nus, data_array, sizeof(data_array));
 nrf_delay_ms(10);
 power_manage();

}

-------------------------------------------------------

It is the most basic code, but it does not make this part.
By the end of this week, code must be created to interact with STM32 and NRF51 DONGLE. 
I'd appreciate your help.

Parents
  • sending data from STM32 to NRF51 DONGLE fails

    So what have you done to debug that failure?

    The Nordic UART demo should just forward whatever it receives from the hardware UART over the BLE link.

    That will work exactly the same whether the data comes from a terminal, or a microcontroller or anything else - so shouldn't require any modifications at all for the STM32.

    How to properly post source code:

  • I tested the baud rate by changing it from 9600 to 115200. 

    I use APP_UART example and that's the whole code I changed.

    and.. I don't know what will I do.. now.. 

  • So go back to the original, unmodified Nordic UART demo

    http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.2.0/ble_sdk_app_nus_eval.html?cp=4_0_0_4_1_2_24

    Use your serial terminal (TeraTerm) to verify that

    • you can send stuff from the terminal to the app;
    • you can send stuff from the app to the terminal.

    See the 'Testing' section in the documentation.

    Pay attention to the notes in the documentation about the handling on newline & carriage return.

    Once you have this working, use the RTT logging to see what's happening inside the code.

    Only when you have this working, and understand the flow of the data through the code, move on to connecting the STM32 ...

    Note that the demo uses the virtual COM port in the on-board JLink for the connection to the PC.

    You can't use that for the STM32!

    Therefore your first step should be to modify the demo so that your TeraTerm connects to UART pins on the board...

  • I checked this demo already. and, it is working...

    I changed RX_TX_PIN NUMBER also..  my custom rx pin is 5, tx pin is 4..

    that's why i start to use stm32.. um.. ;(

    I think we can use this  function ' ble_nus_string_send()'... 

    I sent the text from nrf51822 to nrf 51 dongle.. 

    and, I thought NRF_UART0->RXD is date which is from stm32... 

  • I changed RX_TX_PIN NUMBER also..  my custom rx pin is 5, tx pin is 4..

    But before doing that, did you use the RTT logging to see what's happening inside the code, and understand the flow of the data through the code?

    that's why i start to use stm32

    Did you check that your code still works by using TeraTerm before moving to the STM32?

    This really is key to successful development: take small steps; only change one thing at a time!

    I think we can use this  function ' ble_nus_string_send()'... 

    Don't just "think" - use the debugger and/or the RTT logging to prove it

  • As you said, I am trying to find a reason why it shouldn't be revised from the beginning.

    First, I tried to communicate using nrf51822 and Android phones. and I did. NRF RTT confirmed sending and receiving data.

    Second, it started Nrf51822 and UART communication from STM32 to UART, and matched pin map and baudrate.

    Now I use the NRF RX pin 4,  TX pin is 5..

    But, in the example app_uart, button is using pin 4. There is no pin 4 on my board, so I did not modify it at that time. now, I started to change.

    First, I changed the pinmap of button and Ble started to stop working. So I annotated the button, but this time, I started to get an error. I immediately began to sort out the functions of the button.

    And after that, Finally, I sent a string using the printf function from nrf to stm32. There's a phrase coming out of the stm32 debug port.

    But still Data sent from stm32 to nrf are not verified. 

    You seem to be making some progress. 
    Thank you.

Reply
  • As you said, I am trying to find a reason why it shouldn't be revised from the beginning.

    First, I tried to communicate using nrf51822 and Android phones. and I did. NRF RTT confirmed sending and receiving data.

    Second, it started Nrf51822 and UART communication from STM32 to UART, and matched pin map and baudrate.

    Now I use the NRF RX pin 4,  TX pin is 5..

    But, in the example app_uart, button is using pin 4. There is no pin 4 on my board, so I did not modify it at that time. now, I started to change.

    First, I changed the pinmap of button and Ble started to stop working. So I annotated the button, but this time, I started to get an error. I immediately began to sort out the functions of the button.

    And after that, Finally, I sent a string using the printf function from nrf to stm32. There's a phrase coming out of the stm32 debug port.

    But still Data sent from stm32 to nrf are not verified. 

    You seem to be making some progress. 
    Thank you.

Children
No Data
Related