Using uart4 for bluetooth on imx6q board on android.

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

Using uart4 for bluetooth on imx6q board on android.

Jump to solution
3,232 Views
tangyuan
Contributor III


HI:

    I am using uart4 for bluetooth on imx6q board on android.

    The module i am using is AP6210.But the bluetooth function is unnormal.

    The bluetooth module have 4 signals.They are UART_TXD,UART_RXD,UART_CTS_N,UART_RTS_N.So,the imx6 i using UART4_TX,UART4_RX,UART4_RTS,UART4_CTS

    my connection is as follows:

   AP6210                                                     IMX6

   UART_TX                                                 UART4_RX

   UART_RX                                                UART4_TX

   UART_RTS_N                                           UART4_CTS

   UART_CTS_N                                           UART4_RTS

   in board-mx6q_sabresd.h,i have some define as follows:

 

   MX6Q_PAD_KEY_COL0__UART4_TXD,

   MX6Q_PAD_KEY_ROW0__UART4_RXD,

   MX6Q_PAD_CSI0_DAT16__UART4_RTS,

   MX6Q_PAD_CSI0_DAT17__UART4_CTS,

  in board-mx6q_sabresd.c,i have:imx6q_add_imx_uart(3, NULL);

  The bluetooth work unnormal and the supplier of bluetooth told me that the signal of UART_CTS_N in AP6210 should be low voltage. when the module is turning on.Because it was controlled by UART4_RTS in imx6.

  I measured the UART_CTS_N signal in AP6210 is high voltage (3.3V) all the time.

  So,i would like to say that the UART4_CTS should be special pin or general i/o using?

  Can you anyone help me!

   .

Tags (2)
1 Solution
1,675 Views
PeterChan
NXP Employee
NXP Employee

In arch/arm/mach-mx6/board-mx6q_sabresd.h,  MX6Q_PAD_CSI0_DAT16 &  MX6Q_PAD_CSI0_DAT17 is assigned to mx6q_sabresd_csi0_sensor device, MX6Q_PAD_KEY_COL0 & MX6Q_PAD_KEY_ROW0 are assigned to ECSPI1 device. So, you have to either remove these devices or assign UART port to the other pads.

Regarding your daisy chain question, I meant to configure the IOMUXC_UART4_UART_RTS_B_SELECT_INPUT register to select the UART4 INPUT pin. In this case, you need to set IOMUXC_UART4_UART_RTS_B_SELECT_INPUT=0 to choose UART4_RTS_B as input on CSI0_DAT16 pad.

In arch/arm/plat-mxc/include/mach/iomux-mx6q.h, the definition of _MX6Q_PAD_CSI0_DAT17__UART4_CTS is wrong. In DCE mode, it should be

#define _MX6Q_PAD_CSI0_DAT17__UART4_CTS        \

        IOMUX_PAD(0x066C, 0x029C, 3, 0, 0, 0)

The UART4_CTS_B should output a low voltage when ready to receive data.

Please refer to this document i.MX6: What does the DTE/DCE in i.MX6's UART do and how are RTS and CTS affected by the UARTxUFCR[DT... for more information.

View solution in original post

17 Replies
1,675 Views
PeterChan
NXP Employee
NXP Employee

The CTS and RTS pads should be assigned to UART function pins instead of GPIO. The file arch/arm/mach-mx6/board-mx6sl_evk.c has code to enable UART4. Please refer to the function uart4_init() in this file as an example to setup the UART with RTC/CTS control.

Please be reminded this file is for i.MX6SL and thus the PAD and IOMUX setting may be different from i.MX6Q.

1,675 Views
tangyuan
Contributor III

HI:

    peter:

     In arch/arm/mach-mx6/board-mx6sl_evk.c i cannot find uart4_init().The attached is my board-mx6sl_evk.c.Can you help me.I use the linux 3.0.35.

0 Kudos
1,675 Views
PeterChan
NXP Employee
NXP Employee

Please download the LTIB BSP release L3.0.35_2.1.0_130506 or later version to get the updated board-mx6sl_evk.c for UART4 intialization.

1,675 Views
tangyuan
Contributor III

OK,peter

0 Kudos
1,675 Views
tangyuan
Contributor III


HI:

   peter,i have already get the updated code for UART4 intialization.The bluetooth cann't work still normally.

   I would like to ask the hardware connection is correct as follows ?

                              

   AP6210                                                     IMX6 

   UART_TX                                                   UART4_RX

   UART_RX                                                  UART4_TX

   UART_RTS_N                                            UART4_CTS

   UART_CTS_N                                            UART4_RTS

    Can you give me some advise?

    Thank you very much

0 Kudos
1,675 Views
PeterChan
NXP Employee
NXP Employee

I am afraid your CTS & RTS connections is wrong.

According to i.MX6DQ datasheet table 91 "UART I/O Configuration vs Mode", i.MX6DQ default is DCE mode and port UARTx_CTS_B is direction output. So, it should connect to AP6210 UART_CTS_N (input).

Similarly, i.MX6DQ port UARTx_RTS_B is direction input and it should connect to AP6210 UART_RTS_N (output).

Please be reminded that both UARTx_RTS_B & UARTx_CTS_B involves daisy chain and the respective IOMUXC_UARTX_UART_XXX_B_SELECT_INPUT must be configured.

1,675 Views
tangyuan
Contributor III

HI:

   peter,Because UART4_CTS_B is direction output ,it should output a high voltage or a low voltage?

   The supplier of bluetooth(AP6210) told me that if UART_CTS_N in ap6210 is low voltage ,the AP6210 maybe work normally. But now i found the UART_CTS_N have't low voltage,it is high voltage all the time.

   Can you give me some advise,peter,i need your help

                                                                                                                                                                                                Best Regards

0 Kudos
1,676 Views
PeterChan
NXP Employee
NXP Employee

In arch/arm/mach-mx6/board-mx6q_sabresd.h,  MX6Q_PAD_CSI0_DAT16 &  MX6Q_PAD_CSI0_DAT17 is assigned to mx6q_sabresd_csi0_sensor device, MX6Q_PAD_KEY_COL0 & MX6Q_PAD_KEY_ROW0 are assigned to ECSPI1 device. So, you have to either remove these devices or assign UART port to the other pads.

Regarding your daisy chain question, I meant to configure the IOMUXC_UART4_UART_RTS_B_SELECT_INPUT register to select the UART4 INPUT pin. In this case, you need to set IOMUXC_UART4_UART_RTS_B_SELECT_INPUT=0 to choose UART4_RTS_B as input on CSI0_DAT16 pad.

In arch/arm/plat-mxc/include/mach/iomux-mx6q.h, the definition of _MX6Q_PAD_CSI0_DAT17__UART4_CTS is wrong. In DCE mode, it should be

#define _MX6Q_PAD_CSI0_DAT17__UART4_CTS        \

        IOMUX_PAD(0x066C, 0x029C, 3, 0, 0, 0)

The UART4_CTS_B should output a low voltage when ready to receive data.

Please refer to this document i.MX6: What does the DTE/DCE in i.MX6's UART do and how are RTS and CTS affected by the UARTxUFCR[DT... for more information.

1,675 Views
tangyuan
Contributor III

HI:

   peter:

   I have already readed the mentioned content.I have a little understanding already.However, I want to bother you about.

   1.In arch/arm/plat-mxc/include/mach/iomux-mx6q.h,the original definition of __MX6Q_PAD_CSI0_DAT17__UART4_CTS  is as follows:

  

    #define _MX6Q_PAD_CSI0_DAT17__UART4_CTS   IOMUX_PAD(0x066C, 0x029C, 3, 0x0934, 1, 0)    

    I will modified                #define _MX6Q_PAD_CSI0_DAT17__UART4_CTS   IOMUX_PAD(0x066C, 0x029C, 3, 0, 0, 0)

    the original definiton of _MX6Q_PAD_CSI0_DAT16__UART4_RTS   is #define _MX6Q_PAD_CSI0_DAT16__UART4_RTS   IOMUX_PAD(0x0668, 0x0298, 3, 0x0934, 0, 0)

    I will modified                   #define _MX6Q_PAD_CSI0_DAT16__UART4_RTS   IOMUX_PAD(0x0668, 0x0298, 3, 0, 1, 0)

   2.IMX6DQ is default DEC mode?

   3.If it is DEC mode ,i can acuqire the hardware connection:

   AP6210                                                     IMX6 

   UART_TX                                                   UART4_RX

   UART_RX                                                  UART4_TX

   UART_CTS_N                                            UART4_CTS

   UART_RTS_N                                            UART4_RTS

  peter, I hope you can give me some advice finally.Thank you very much

                                                                                                                                                              Best Regards

1,675 Views
ShawnBai
Contributor III

Very Helpful, thank you both.

0 Kudos
1,675 Views
xuanpingxuanpin
Contributor I

The problem i also faced, and  has solved . If someone want to know how to solve it ,please commnicate with me,. QQ :497657084

0 Kudos
1,675 Views
PeterChan
NXP Employee
NXP Employee

1. Please use


#define _MX6Q_PAD_CSI0_DAT16__UART4_RTS   IOMUX_PAD(0x0668, 0x0298, 3, 0x0934, 0, 0)

#define _MX6Q_PAD_CSI0_DAT17__UART4_CTS   IOMUX_PAD(0x066C, 0x029C, 3, 0, 0, 0)


The original _MX6Q_PAD_CSI0_DAT16__UART4_RTS definition in BSP is correct. It is because you need to set the IOMUXC_UART4_UART_RTS_B_SELECT_INPUT (IOMUX_BASE + 0x934) ) to 0 for CSI0_DAT16 as UART4_RTS_B.


The IOMUXC_UART4_UART_RTS_B_SELECT_INPUT is to select which pad acts as UART port input. In DCE mode, UART4_RTS_B is the UART input (see Datasheet Table 91).


FYI, when DTE mode (not likely), IOMUXC_UART4_UART_RTS_B_SELECT_INPUT needs to be 1 for CSI0_DAT17 as UART4_CTS_B. This is because UART4_CTS_B is the UART input in DTE mode.


2. In LTIB BSP, all UART ports are default in DCE mode.


3. This connection is correct when i.MX6 UART is operating in DCE mode.

0 Kudos
1,675 Views
tangyuan
Contributor III

HI:

    peter,Thank you very much!

                                                    Best regards

0 Kudos
1,675 Views
tangyuan
Contributor III

HI:

   peter:

   Thanks you very much.I am going to have a look about the mentioned content.

                                                                                                                                                                                   Best Regards

0 Kudos
1,675 Views
tangyuan
Contributor III

HI:

   peter,thanks you very much.  I'm going to carefully configure the connection of CTS and RTS. I trust you.But,this word:Please be reminded that both UARTx_RTS_B & UARTx_CTS_B involves daisy chain and the respective IOMUXC_UARTX_UART_XXX_B_SELECT_INPUT must be configured. I can't understand.

  I have already modified :

  In board-mx6q_sabresd.h:

 

MX6Q_PAD_KEY_COL0__UART4_TXD,

  MX6Q_PAD_KEY_ROW0__UART4_RXD,

  MX6Q_PAD_CSI0_DAT16__UART4_RTS,

  MX6Q_PAD_CSI0_DAT17__UART4_CTS,

  in board-mx6q_sabresd.c:

 

static const struct imxuart_platform_data  mx6q_bl_uart4_data = {

.flags = IMXUART_HAVE_RTSCTS,

//.flags = IMXUART_HAVE_RTSCTS | IMXUART_USE_DCEDTE | IMXUART_SDMA,

.dma_req_rx = MX6Q_DMA_REQ_UART4_RX,

.dma_req_tx = MX6Q_DMA_REQ_UART4_TX,

};

  imx6q_add_imx_uart(3, &mx6q_bl_uart4_data);

0 Kudos
1,675 Views
Wlodek_D_
Senior Contributor II

Hello,

Thank you for your post, however please consider moving it to the right community place (e.g. i.MX Community ) to get it visible for active members.

For details please see general advice Where to post a Discussion?

Thank you for using Freescale Community.

0 Kudos
1,675 Views
tangyuan
Contributor III

OK,THANK YOU

0 Kudos