S32K312 LPUART – Framing Error at 1 Mbps Baud Rate with 30 MHz LPUART Clock Hi NXP Team, I am working with an NXP S32K312 MCU and using the LPUART peripheral. The required UART baud rate for the communication is 1 Mbps. The LPUART 6 functional clock is 30 MHz. I initially configured the UART with: Baud rate: 1,000,000 bps LPUART clock: 30 MHz SBR or Mantissa: 2 OSR or Divisor: 15 Data bits: 8 Parity: None Stop bits: 1 LSB first With this configuration, I observed a framing error during communication. I understand that with the LPUART baud rate calculation: Baud Rate = LPUART Clock divided by SBR multiplied by OSR I also tried a configuration intended to achieve exactly 1 Mbps: SBR = 2 OSR = 15 Baud rate = 30 MHz divided by 2 multiplied by 15 = 1 Mbps However, I am still observing a framing error. I also tried 921600 baud, but I observed a framing error at this baud rate as well. Current observations LPUART clock: 30 MHz Required communication baud rate: 1 Mbps UART configuration: 8 N 1 Framing error is observed at 1 Mbps Framing error is also observed at 921600 baud The communication is with a TI BQ79600 bridge The TX waveform is being monitored using a logic analyzer Could you please help clarify: Does the S32K312 LPUART reliably support 1 Mbps UART communication with a 30 MHz LPUART clock? Is there a recommended OSR and SBR combination for achieving 1 Mbps with a 30 MHz clock? Are there any known limitations or restrictions related to OSR values, SBR values, or baud rate accuracy at 1 Mbps? Is there any additional LPUART configuration required for reliable 1 Mbps communication? Is there any recommended clock frequency for the LPUART when communicating at 1 Mbps? Could the framing error be related to the LPUART sampling configuration or clock tolerance? I can provide the LPUART BAUD register value, RTD configuration, and logic analyzer capture if required. Please advise on the recommended configuration and any additional debugging steps. Thanks. Re: S32K312 LPUART – Framing Error at 1 Mbps Baud Rate with 30 MHz LPUART Clock Hello @gayathri123 ,
A framing error is a receiver-side error. Therefore, temporarily remuxing PTD9, which is used as LPUART6_TX, should not by itself set the LPUART framing-error flag. The framing error indicates that the receiver detected logic 0 where it expected a stop bit.
Could you please confirm whether the error is reported in LPUART6_STAT[FE], by the BQ79600 or only by the logic analyzer?
The 2.75 ms LOW wake-up pulse is much longer than a UART frame. If the LOW level is also present on the S32K312 RX input while the receiver remains enabled, the LPUART may correctly report a framing error because no valid stop bit is detected. The flag may therefore originate from the wake-up phase and remain set when normal UART communication starts.
As a test, please:
Disable the LPUART receiver and transmitter before changing the pin mux.
Generate the wake-up pulse using GPIO.
Return the GPIO output to HIGH.
Remux PTD9 to LPUART6_TX.
Clear any previous receive error flags.
Re-enable LPUART and wait for the required BQ79600 wake-up recovery time.
Transmit a valid command frame.
Please provide a logic-analyzer capture of both TX and RX, together with the LPUART6_STAT value before and after the wake-up pulse. It is particularly important to identify the exact moment when STAT[FE] becomes set.
Best regards,
Pavel
Re: S32K312 LPUART – Framing Error at 1 Mbps Baud Rate with 30 MHz LPUART Clock Hi We are using an S32K312 with LPUART6 configured at 1 Mbps. PTD9 is configured as the LPUART6 TX pin. We are observing a framing error during UART communication when we temporarily configure PTD9 as GPIO and then remux it back to LPUART6 TX. The sequence is as follows: Configure PTD9 as GPIO and drive it LOW for approximately 2.75 ms to generate the required wake-up pulse. Remux PTD9 back to LPUART6_TX. Transmit dummy data through LPUART6 at 1 Mbps. A framing error is observed during the UART communication. Re: S32K312 LPUART – Framing Error at 1 Mbps Baud Rate with 30 MHz LPUART Clock Hello @gayathri123 ,
Thank you for the detailed description.
The first point to clarify is the LPUART baud-rate formula. For the S32K3 LPUART, the effective baud rate is calculated as:
Baud rate = LPUART functional clock / (SBR × (OSR + 1))
Therefore, if the BAUD register contains SBR = 2 and OSR = 15, the resulting baud rate is:
30 MHz / (2 × 16) = 937,500 baud
It is therefore not 1 Mbps. This deviation is large enough to cause a framing error when the communication partner operates at 1 Mbps.
For a 30 MHz LPUART functional clock, an exact 1 Mbps baud rate can be obtained with:
SBR = 2
OSR register value = 14
Effective oversampling ratio = 15
30 MHz / (2 × 15) = 1,000,000 baud
Please note that some configuration tools may display the effective oversampling ratio, while the BAUD register stores this value minus one. For this reason, please read back the complete LPUART6_BAUD register after initialization and verify the actual OSR and SBR fields.
The S32K312 LPUART can support 1 Mbps communication. A 30 MHz functional clock is also suitable because it allows the baud rate to be generated exactly. No special additional configuration should normally be required beyond the correct clock, baud-rate settings, frame format, pin configuration and receiver configuration.
Best regards,
Pavel
記事全体を表示