MQX 3.8 Disable UART

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
3,660件の閲覧回数
AA7
Contributor I

Hi,

With MQX 3.8.

We are using the macro BSPCFG_ENABLE_TTYA and the API function _mcf54xx_uart_serial_polled_install to configure the UART and use it as the default interface for the Shell and the standard IO functions. This works just fine. Now we want to enable/disable the uart at runtime. We have tried disabling the UART,

- writing directly to the peripheral registers,

- using _io_set_handle(IO_PROC_STDOUT(or IN), gs_NullDrv) (as suggested in the forum)

- or with _io_fclose().

Either MQX crashes or the UART does not get disabled. What would be the right way to disable and re-enable the UART?

タグ(1)
0 件の賞賛
返信
1 解決策
3,628件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Sorry I only have MQX 4.2 installed on my PC.

Please refer to the implement in MQX 4.2

 

serial.h

 

#define IO_IOCTL_SERIAL_DISABLE_RX _IO(IO_TYPE_SERIAL,0x17)
#define IO_IOCTL_SERIAL_WAIT_FOR_TC _IO(IO_TYPE_SERIAL,0x18)

 

sel_pol_kuart.c


case IO_IOCTL_SERIAL_DISABLE_RX:
if( *(bool *)param_ptr == TRUE )
{
/* disable receiver */
sci_ptr->C2 &=~UART_C2_RE_MASK;
}
else
{
/* enable receiver */
sci_ptr->C2 |= UART_C2_RE_MASK;
}
break;

 

 

Regards

Daniel

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
3,637件の閲覧回数
AA7
Contributor I

I am getting IO_ERROR_INVALID_IOCTL_CMD, is it possible IO_IOCTL_SERIAL_DISABLE_RX is not implemented in MQX 3.8?

0 件の賞賛
返信
3,629件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Sorry I only have MQX 4.2 installed on my PC.

Please refer to the implement in MQX 4.2

 

serial.h

 

#define IO_IOCTL_SERIAL_DISABLE_RX _IO(IO_TYPE_SERIAL,0x17)
#define IO_IOCTL_SERIAL_WAIT_FOR_TC _IO(IO_TYPE_SERIAL,0x18)

 

sel_pol_kuart.c


case IO_IOCTL_SERIAL_DISABLE_RX:
if( *(bool *)param_ptr == TRUE )
{
/* disable receiver */
sci_ptr->C2 &=~UART_C2_RE_MASK;
}
else
{
/* enable receiver */
sci_ptr->C2 |= UART_C2_RE_MASK;
}
break;

 

 

Regards

Daniel

0 件の賞賛
返信
3,613件の閲覧回数
AA7
Contributor I

I ported the code to 3.8 and is all ok. Thanks for your help.

0 件の賞賛
返信
3,654件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Hi

I would suggest you use I/O control commands.

 

IO_IOCTL_SERIAL_CLEAR_STAT :  Clear the statistics.

IO_IOCTL_SERIAL_SET_BAUD:      Set the BAUD rate.

IO_IOCTL_SERIAL_DISABLE_RX:   Disable or enable UART receiver.

 

Regards

Daniel

0 件の賞賛
返信