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

merged the ble_app_uart and twi sensor program

 HI 

I am using the customized nRF52832  board with a temperature sensor connected via i2c .Firmware i merged the ble_app_uart and twi_sensor xample code. Here the RX AND SDA pins are same , so i changed to

RX - 27 

TX - 26

SDA - 8  (FOR MY CUSTOMIZED NRF BOARD I2C PIN NUMBERS )

SCL - 7

DO I WANT TO CHANGE ANY OTHER THING ?

 I used the step by step debug to find the error, getting NRF_BREAKOUT_POINT at this point 

   APP_ERROR_CHECK(err_code); in uart_init();

Parents
  • Hello,

    What do you mean by "getting NRF_BREAKOUT_POINT at this point"? As far as I can tell NRF_BREAKOUT_POINT is not a return value in the SDK. 

    hat does uart_init() return? What pins do you use for the UART?

    static void uart_init(void)
    {
        uint32_t                     err_code;
        app_uart_comm_params_t const comm_params =
        {
            .rx_pin_no    = RX_PIN_NUMBER,
            .tx_pin_no    = TX_PIN_NUMBER,
            .rts_pin_no   = RTS_PIN_NUMBER,
            .cts_pin_no   = CTS_PIN_NUMBER,
            .flow_control = APP_UART_FLOW_CONTROL_DISABLED,
            .use_parity   = false,
    #if defined (UART_PRESENT)
            .baud_rate    = NRF_UART_BAUDRATE_115200
    #else
            .baud_rate    = NRF_UARTE_BAUDRATE_115200
    #endif
        };

    What are RX_PIN_NUMBER, TX_PIN_NUMBER, RTS_PIN_NUMBER, CTS_PIN_NUMBER and .flow_control in your project? I suspect that you have some conflicting pins in your application, as the default RX pin and CTS pin are 8 and 7, respectively, by default in the SDK examples for the nRF52832.

    Best regards,

    Edvin

Reply
  • Hello,

    What do you mean by "getting NRF_BREAKOUT_POINT at this point"? As far as I can tell NRF_BREAKOUT_POINT is not a return value in the SDK. 

    hat does uart_init() return? What pins do you use for the UART?

    static void uart_init(void)
    {
        uint32_t                     err_code;
        app_uart_comm_params_t const comm_params =
        {
            .rx_pin_no    = RX_PIN_NUMBER,
            .tx_pin_no    = TX_PIN_NUMBER,
            .rts_pin_no   = RTS_PIN_NUMBER,
            .cts_pin_no   = CTS_PIN_NUMBER,
            .flow_control = APP_UART_FLOW_CONTROL_DISABLED,
            .use_parity   = false,
    #if defined (UART_PRESENT)
            .baud_rate    = NRF_UART_BAUDRATE_115200
    #else
            .baud_rate    = NRF_UARTE_BAUDRATE_115200
    #endif
        };

    What are RX_PIN_NUMBER, TX_PIN_NUMBER, RTS_PIN_NUMBER, CTS_PIN_NUMBER and .flow_control in your project? I suspect that you have some conflicting pins in your application, as the default RX pin and CTS pin are 8 and 7, respectively, by default in the SDK examples for the nRF52832.

    Best regards,

    Edvin

Children
  • For my  customized schematics sda and scl pin is 8 and 7 , so i changed the default RX and TX to 27 and 26 

    do i want to change the CTS pin number ?

    #define RX_PIN_NUMBER 27
    #define TX_PIN_NUMBER 26
    #define CTS_PIN_NUMBER 7
    #define RTS_PIN_NUMBER 5
    #define HWFC true
    
    
    
    // Arduino board mappings
    #define ARDUINO_SCL_PIN 8 // SCL signal pin
    #define ARDUINO_SDA_PIN 7 // SDA signal pin
    #define ARDUINO_AREF_PIN 2 // Aref pin
    

  • This means that your SPI and UART are trying to use the same pin. What SDK version do you use? And what does uart_init() return?

    err_code = uart_init();
    NRF_LOG_INFO("uart_init returned 0x%08x", err_code);

    What does this print?

    Try to set HWFC to false, so that the UART doesn't use the CTS and RTS pins. Perhaps that solves it. But then your UART doesn't have flow control. If you intend to use that, then you need to set the CTS and RTS pins to something that is not used by anything else, or change the SPI pins to not use the same pins as the UART.

  • Thanks  Edvin .

    using sdk version 15.2 .I am getting fatal error in debug terminal . Even again after making HWFC to false .One more  same code by changing the RX AND TX pin , it successfully ran by last week. i got the data in mobile app too

    •  I changed the HWFC  false  . As per below is it fine or else I should disable the hardware flow control in sdk. Configuration also  

    #define RX_PIN_NUMBER 27
    #define TX_PIN_NUMBER 26
    #define CTS_PIN_NUMBER 7
    #define RTS_PIN_NUMBER 5
    #define HWFC   false 

Related