3Mbps baud for BT interface

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

3Mbps baud for BT interface

1,034 Views
dvlogic
Contributor III
Hi,
 
We are using a i.MX8MN (MIMX8MN1DVPIZAA) along with an Azurewave (AW-CM358SM) WIFI/BT module (based on the NXP 88W8987).  When we increase the BT baud rate to 3Mbps, we get about a 5% failure rate to bring the HCI interface back up at the higher baud.  We never have any failures brining the HCI interface up at the default 115200 bps.
 
The application engineer at Azurewave mentioned that we should configure the UART interface in DTE mode.  When I configure for DTE mode, nothing works.  We can only communicate with the BT if the UART is in the default DCE mode.  From further reading, I believe the Azurewave engineer might be correct, as I think RTS/CTS handshaking is designed for DTE mode.  In fact, when I'm configured in DCE mode, I never see the handshaking lines change state, which is maybe why the higher rate fails? 
 
Our design is based on the i.MX8M NANO DD3 EVK (8MNANOD3L-EVK) board.  Wired almost identical to that board.  I believe that board also configures the UART to DCE mode. 
 
Here is how I have our DTS file configured for DTE mode:
 

 

 

    &uart1 { /* BT */
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_uart1>;
        assigned-clocks = <&clk IMX8MN_CLK_UART1>;
        assigned-clock-parents = <&clk IMX8MN_SYS_PLL1_80M>;
        fsl,dte-mode;
        fsl,uart-has-rtscts;
        resets = <&modem_reset>;
        status = "okay";
    };


        pinctrl_uart1: uart1grp {
            fsl,pins = <
                MX8MN_IOMUXC_UART1_RXD_UART1_DTE_TX 0x140
                MX8MN_IOMUXC_UART1_TXD_UART1_DTE_RX 0x140
                MX8MN_IOMUXC_UART3_RXD_UART1_DTE_RTS_B 0x140
                MX8MN_IOMUXC_UART3_TXD_UART1_DTE_CTS_B 0x140
            >;
        };

    /*
        pinctrl_uart1: uart1grp {
            fsl,pins = <
                MX8MN_IOMUXC_UART1_RXD_UART1_DCE_RX 0x140
                MX8MN_IOMUXC_UART1_TXD_UART1_DCE_TX 0x140
                MX8MN_IOMUXC_UART3_RXD_UART1_DCE_CTS_B 0x140
                MX8MN_IOMUXC_UART3_TXD_UART1_DCE_RTS_B 0x140
            >;
        };
    */

 

 

If anyone has any insight to configuring the BT interface to to allow it reliably to operate at the 3Mbps rate, please let me know.
 
Thanks!

 

0 Kudos
5 Replies

996 Views
dvlogic
Contributor III

Hi,

What is the dtron parameter passed into the hciattach command?  My configuration is nearly identical to what you show, but without that dtron param.  I'm also not passing reset as a parameter to the hciconfigcommand.  I will try to add both of those and see if it makes a  difference.  Still it would be nice to know what the dtron param does since I can't find any documentation on it.

Thanks.

0 Kudos

982 Views
Christine_Li
NXP TechSupport
NXP TechSupport

HI, dvlogic,

The parameter "dtron" means DTR(Data Terminal Ready) on.

It is not necessary to use this parameter during change baud rate to 3Mbps.

Without this parameter, should also be successful to change. Need to remind you that, please firstly set it to 115200 after loading driver, then change it to 3M bps. 

We have tested it on i.mx 8MNano built-in 88W8987 chip.

Below is our test screenshot:

Christine_Li_0-1673406364472.png

Please have a try and let us know the result, thanks.

 

Best regards,

Christine.

0 Kudos

954 Views
dvlogic
Contributor III

Hi,

We are still getting failures about 5% of the time, but only when we increase the baud to 3Mbps. If we comment out the code to increase the UART speed, we never have a failure.  Here is the code we are using (which is very similar to what you shared and what is in other documents).

function increase_port_speed
{
    rate=${1:-3000000}

    echo "change the speed to $rate"
    rateStr=$(printf "0x3f 0x0009 0x%x 0x%x 0x%x 0x%x" \
        $((rate & 255)) $((rate>>8 & 255)) $((rate>>16 & 255)) $((rate>>24 & 255)))
    hcitool -i hci0 cmd $rateStr
    sleep 1
    killall hciattach
    sleep 1
    hciattach /dev/ttymxc0 any -s $rate $rate flow nosleep
    hciconfig hci0 reset || fail "Can't bring hci0 up at rate $rate"
}

function start 
{
    echo  "Starting server.."
    # make sure the WIFI driver is loaded
    modprobe moal mod_para=nxp/wifi_mod_para.conf 
    sleep 5
    # make sure the Bluetooth is configured
    hciattach /dev/ttymxc0 -b -s 115200 any 115200 flow nosleep
    hciconfig hci0 up || fail "Can't start at 115200"
    sleep 1
    # Increase the BT baud rate
    increase_port_speed 3000000
    echo "256" > /sys/kernel/debug/bluetooth/hci0/adv_min_interval || fail "Can't set adv_min"
    echo "1024" > /sys/kernel/debug/bluetooth/hci0/adv_max_interval || fail "Can't set adv_max"
}

Let me know if you you additional ideas on how to determine what is causing the failures.

Thanks,

Dave

 

0 Kudos

946 Views
Christine_Li
NXP TechSupport
NXP TechSupport

HI, Dave,

Could you please have a try with below code and add more sleep time?

Like below:

function increase_port_speed
{
rate=${1:-3000000}

echo "change the speed to $rate"
rateStr=$(printf "0x3f 0x0009 0x%x 0x%x 0x%x 0x%x" \
$((rate & 255)) $((rate>>8 & 255)) $((rate>>16 & 255)) $((rate>>24 & 255)))
hcitool -i hci0 cmd $rateStr
sleep 5
killall hcitool
sleep 5
killall hciattach
sleep 5
hciattach /dev/ttymxc0 any -s $rate $rate flow
hciconfig hci0 up || fail "Can't bring hci0 up at rate $rate"
}

function start
{
echo "Starting server.."
# make sure the WIFI driver is loaded
modprobe moal mod_para=nxp/wifi_mod_para.conf
sleep 5
# make sure the Bluetooth is configured
hciattach /dev/ttymxc0 any -s 115200 115200 flow
hciconfig hci0 up || fail "Can't start at 115200"
sleep 5
# Increase the BT baud rate
increase_port_speed 3000000
echo "256" > /sys/kernel/debug/bluetooth/hci0/adv_min_interval || fail "Can't set adv_min"
echo "1024" > /sys/kernel/debug/bluetooth/hci0/adv_max_interval || fail "Can't set adv_max"
}
 

And if still fail, please also share me the related logs. Thanks.

Best regards,

Christine.

0 Kudos

1,005 Views
Christine_Li
NXP TechSupport
NXP TechSupport

Dear Customer,

To change the baud rate to 3 Mbps, execute the following commands:
# clean up any existing UART conn
killall hciattach
# assume initial rate is 115200 bps
hciattach ttyUSB0 any -s 115200 115200 flow dtron
# change baud rate to 3 Mbps
hcitool -i hci0 cmd 0x3F 0x0009 0xC0 0xC6 0x2D 0x00 &
killall hcitool
killall hciattach
# reconnect at 3 Mbps
hciattach ttyUSB0 any -s 3000000 3000000 flow dtron
hciconfig hci0 reset
sleep 1
hciconfig

We default works as DCE, please have a try with above command. It is not necessary to do any changes in DTS.

Kindly remind, please use 115200 bps to do hciattach firstly after insmod Bluetooth driver, then change it to 3Mbps with hciattach commands.

 

Best regards,

Christine.

 

0 Kudos