Using NRF52 (NRF52832) as bluetooth module for my psoc 6

Hi 

I have a mbed application, which runs on a PSOC6 MCU, i am going to be using a fanstel BC832 (which is based of NRF52832)BT module for RF-communication. To verify that my project can run on the fanstel module, I have the nRF52, until I get my board with the fanstel module. I am using mbed 5.14.1, which uses cordio stack for uart communication with the bt module. 

So i got two question: 
1) is there a specfic .hex which needs to be on my nRF52 when using it as a BT module? if, where can i find this? 
2) Might be out of scope, but how do i configure my mbed setup, so i am using the correct nordic drivers? 

Thanks 

  • Hi again @Hung_Bui

    I have am running nrf52832 with zephyr's HCI_UART sample, and has connected that to my PSOC. 

    I am able to read out the following command (from PSOC perspective) 
    TX: 0x01030C00 (A reset cmd, i assume) 
    RX: 0x040E0401030C00 (Correct response)

    There is a delay between the two above cmd, so i seems like something is taking time to reset...

    Next TX is: 0x0119FC060000C0C62D00
    RX: 0x040F04010118FX 

    And then it stops. Nothing happens hereafter. 
    Flow control is still not working. 

    Any hints? 

  • Hi Karl, 


    By having hw-flow-control; in the device tree the hw flow control should be selected, and it's by default the HCI UART (H4) should be. 
    Have you tried to manually pull the RTS or CTS pin up to see if the communication stop ? Could you try to test with some simple UART sample first ? 


    Could you try to use Zephyr host to test with the controller ? Meaning using 2 nRF52 to each other ? This way it will be easier for us to reproduce the issue. You can follow the guide here: https://docs.nordicsemi.com/bundle/ncs-2.4.0/page/zephyr/samples/bluetooth/hci_uart/README.html

  • Hi  

    I will try manually pulling the CTS/RTS pins. 

    Did you see my first response to your previous reply? I only have one nRF52, but as said. I have tried via the serial connection through the nRF52's interface MCU to nRF52832 where i can write simple uart command, and get a response back. I have tried to mimic HCI command, and it responded fine. But I have yet to figure out the cmd sequence to make the controller(nRF52832) advertising. And here flow control doesn't work either. 

  • Hi Karl Johan, 


    I am checking here why the CTS and RTS pins are not used. I tested with some simple sample (echo_bot) and seeing the same issue. 

  • Hi  

    Good to hear, that you are experiencing the same thing. So it seems like flow control is not correct implemented/configured in the sample code? 
    It have tried to modify the hci_uart_int() in the main.c file to try and "enforce" the flow control. 

    Here is my updated hci_uart_int()

    static int hci_uart_init(void)
    {
        LOG_DBG("");
    
        if (IS_ENABLED(CONFIG_USB_CDC_ACM)) {
            if (usb_enable(NULL)) {
                LOG_ERR("Failed to enable USB");
                return -EINVAL;
            }
        }
    
        if (!device_is_ready(hci_uart_dev)) {
            LOG_ERR("HCI UART %s is not ready", hci_uart_dev->name);
            return -EINVAL;
        }
    
        // UART configuration structure
        const struct uart_config uart_cfg = {
            .baudrate = 115200,                 // Set the baud rate
            .data_bits = UART_CFG_DATA_BITS_8,   // 8 data bits
            .parity = UART_CFG_PARITY_NONE,      // No parity
            .stop_bits = UART_CFG_STOP_BITS_1,   // 1 stop bit
            .flow_ctrl = UART_CFG_FLOW_CTRL_RTS_CTS, // Enable RTS/CTS flow control
        };
    
        // Configure the UART with the flow control settings
        int err = uart_configure(hci_uart_dev, &uart_cfg);
        if (err) {
            LOG_ERR("Failed to configure UART");
            return err;
        }
    
        uart_irq_rx_disable(hci_uart_dev);
        uart_irq_tx_disable(hci_uart_dev);
    
        uart_irq_callback_set(hci_uart_dev, bt_uart_isr);
    
        // Enable UART RX interrupt
        uart_irq_rx_enable(hci_uart_dev);
    
        return 0;
    }


    This did not fix the issue, but it caused P0.5 RTS to go high during first transmission, and never to go low again. 

    Best regards 
    Karl-Johan 

Related