TI中文支持网
TI专业的中文技术问题搜集分享网站

TMS570LC4357: 在RTOS中,串口SCI4的配置和使用?

Part Number:TMS570LC4357Other Parts Discussed in Thread:HALCOGEN

你好:

    我对LC4357的SCI4串口进行了配置,想通过SCI4口进行串行收发,但配置完成之后,串口并不能正常工作,以下是我的配置代码,其中参考了LS3137的配置,因为我发现4357的寄存器基本上跟3137的一样。

 do{sciRegBase->GCR0 = 1U;--nTimeout;}while((sciRegBase->GCR0 != 1U) && (nTimeout > 0U)); /* repeat until bit is set and timeout does not elapsed yet *//** - Disable all interrupts */sciRegBase->CLEARINT= 0xFFFFFFFFU;sciRegBase->CLEARINTLVL = 0xFFFFFFFFU;/* @todo: */U32 parityBits = sciGetParityConfig(pUart->flags.parity);/** - global control 1 */sciRegBase->GCR1 = (1U << 25U)/* enable transmit */| (1U << 24U)		/* enable receive */// | (1U << 17)		/* continue on suspend (when debug mode is entered) */| (1U << 5U)		/* internal clock (device has no clock pin) */| (0U << 4U)					/* number of stop bits */ // 1 stop bit| (0U << 3U)		/* even parity, otherwise odd */| (0U<< 2U)/* disable parity */| (1U << 1U);		/* asynchronous timing mode *//** - set baudrate */ // (50M/115200)/16-1 = 26sciRegBase->BRS  = (((U32) (Q_SCI_VCLK1 / pUart->baudRate) >> 4U) - 1U) & Q_SCI_BRR_P_MAX; /* M is not applied *//** - transmission length */sciRegBase->FORMAT = 0U << 16U/* length of response field */| (pUart->flags.numbits - 1U);  /* character bit length *//** - set SCI pins functional mode */ // set transmit pinsciRegBase->PIO0 = (1U << 2U)  /* tx pin */| (1U << 1U)  /* rx pin */| (0U);  /* clk pin *//** - set SCI pins default output value */sciRegBase->PIO3 = (0U << 2U)  /* tx pin */| (0U << 1U)  /* rx pin */| (0U);  /* clk pin *//** - set SCI pins output direction *///16sciRegBase->PIO1 = (0U << 2U)  /* tx pin */| (0U << 1U)  /* rx pin */| (0U);  /* clk pin *//** - set SCI pins open drain disable */sciRegBase->PIO6 = (0U << 2U)  /* tx pin */| (0U << 1U)  /* rx pin */| (0U);  /* clk pin *//** - set SCI pins pullup/pulldown disable */sciRegBase->PIO7 = (1U << 2U)  /* tx pin */| (1U << 1U)  /* rx pin */| (0U);  /* clk pin *//** - set SCI pins pullup/pulldown select */// pull upsciRegBase->PIO8 = (1U << 2U)  /* tx pin */| (1U << 1U)  /* rx pin */| (1U);  /* clk pin *//** - set interrupt level */sciRegBase->SETINTLVL = (0U << 26U)  /* Framing error */| (0U << 25U)  /* Overrun error */| (0U << 24U)  /* Parity error */| (0U << 9U)  /* Receive */| (0U << 8U)  /* Transmit */| (0U << 1U)  /* Wakeup */| (0U);  /* Break detect */uartIntEnable(pUart, False);/** - clear interrupt flags */sciRegBase->FLR = 0xFFFFFFFF;/* @todo: TXWAKE (10th bit of FLR) is selected, so the 1st byte was treated as address. Writing 0 to TXMAKE will solve your problem*/// sciRegBase->FLR &= ~(1<<10);/** - initialize global transfer variables *///g_sciTransfer_t[0U].mode= 0U << 8U;//g_sciTransfer_t[0U].length = 0U;/** - Finaly start SCI */sciRegBase->GCR1 |= (1U << 7U);

1. 请问有lc4357的SCI demo 代码吗? 我可以直接参考?

2. rtos会不会对SCI产生什么影响?因为这个SCI是为了做uartbootloader用的,我的配置其实是参考TMS570LS3x的uart_bootloader的配置的

Susan Yang:

li xy 说:请问有lc4357的SCI demo 代码吗? 我可以直接参考?

您可以在下载HALGOGEN后获取

C:\ti\Hercules\HALCoGen\v04.07.01\examples\TMS570LC43x 

li xy 说:2. rtos会不会对SCI产生什么影响?

您的影响具体是指什么? 其实RTOS是一种通用的任务管理框架,用于控制任务的运行和任务之间的交互,保证时间得到实时处理。

赞(0)
未经允许不得转载:TI中文支持网 » TMS570LC4357: 在RTOS中,串口SCI4的配置和使用?
分享到: 更多 (0)

© 2024 TI中文支持网   网站地图 鲁ICP备2022002796号-1