S32K148 LPSPI Baudrate error

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

S32K148 LPSPI Baudrate error

1,570 Views
FBS
Contributor II

Hi NXP community

I'm trying to configure LPSPI0 master to transmit at 4,8MBaudrate in RUN mode, but I have some issues that I explain below. I'm working with the s32k148 EVB and S32DS IDE (Version 3.4). 

First of all I try to set LPSPI0 master at 2,4MBaudrate. The applied settings can be seen in the following images.

1NXP.JPG

NXP2.JPG

When I check it in oscilloscope it seems that the transmitted frame contains the correct information I wanted to send, but at a lower baud rate than I set. The actual baud rate being applied is 2MBaudrate.

Then I try to set LPSPI0 at 4,8MBaudrate with LPSPI0_CLK_SEL = 24MHz (FIRCDIV2 / 2). When I check it in oscilloscope the sent frame was altered and the baud rate of the transmission was lower than that set (4MBaudrate).

I seem to be applying incorrect settings to the LPSPI source clock but I don't see what's going on. Any suggestion?

Thanks in advance.

Labels (1)
Tags (3)
0 Kudos
6 Replies

1,544 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@FBS

Senlent_0-1647224091272.png

Senlent_1-1647224100917.png

take a look at the function : LPSPI_SetBaudRate();

this function takes in the desired baud rate and calculates the nearset possible baud rate,and retures the calculated baud rate in bits-per-second.

in other words, this function will change the set baudrate to the nearset possible baud rate.

BR!

      Jim,

0 Kudos

1,539 Views
FBS
Contributor II

Hi @Senlent,

Thanks for the reply!

 

I checked the return value of the function  LPSPI_SetBaudRate() and coincides with the devition I was saying.

But there’s still one thing I don’t understand. When I set LPSPI0 at 4,8MBaudrate with LPSPI0_CLK_SEL = 24MHz (FIRCDIV2 / 2), there seems to be a pause in the middle of the 4 bytes I’m sending.

Inkedphoto5870704704739195328_LI.jpg

Then I tried to sending the same frame with the same baud rate but switching to to HSRUN mode. This pause disappears, do you know what it might be due to?

0 Kudos

1,531 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@FBS

        I haven't had this problem before, but  I feel that it has something to do with the clock configuration of some modules. Without more information, I can't judge the possible reasons.can you tell me which routine you use?

BR!

     Jim,

0 Kudos

1,499 Views
FBS
Contributor II

Hi @Senlent 

Sorry for the late response.

To isolate the problem as much as possible I have done a project that only sets LPSPI0 as master with the parameters discussed in the previous post. The program makes an infinite loop that only makes transmissions and wais. That way you can see the problem I'm talking about with the oscilloscope.

If you need to clarify anything about the management or configuration I do in the LPSPI interface, please let me know.

Best regards,

 

0 Kudos

1,494 Views
Senlent
NXP TechSupport
NXP TechSupport

ok, i probably won't have time to test for you until next week

0 Kudos

1,395 Views
FBS
Contributor II

Hi @Senlent 

Any news?

0 Kudos