Other Parts Discussed in Thread: HALCOGEN
Dear Sir:
sci module question:
set baudrate used this sub-function:
/** @fn void sciSetBaudrate(sciBASE_t *sci, uint32 baud)
* @brief Change baudrate at runtime.
* @param[in] sci - sci module base address
* @param[in] baud - baudrate in Hz
*
* Change the SCI baudrate at runtime.
*/
/* SourceId : SCI_SourceId_003 */
/* DesignId : SCI_DesignId_003 */
/* Requirements : HL_SR232 */
void sciSetBaudrate(sciBASE_t *sci, uint32 baud)
{
float64 vclk = 110.000 * 1000000.0;
uint32 f = ((sci->GCR1 & 2U) == 2U) ? 16U : 1U;
uint32 temp;
float64 temp2;
/* USER CODE BEGIN (6) */
/* USER CODE END */
/*SAFETYMCUSW 96 S MR:6.1 <APPROVED> "Calculations including int and float cannot be avoided" */
temp = (f*(baud));
temp2 = ((vclk)/((float64)temp))-1U;
temp2 = floor(temp2 + 0.5); /* Rounding-off to the closest integer */
sci->BRS = (uint32)((uint32)temp2 & 0x00FFFFFFU);
/* USER CODE BEGIN (7) */
/* USER CODE END */
}
I connect with PC COM1 port( physical port, not USB <->UART)
TX can do 115200/57600 ~ 9600/4800/2400/1200 baudrate
RX can do 115200/57600 ~ 9600, but the 4800/2400/1200 baudrate out ot function