Bug or Problem in LPSPI_MasterSetBaudRate for 1060EVK-B

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Bug or Problem in LPSPI_MasterSetBaudRate for 1060EVK-B

565 次查看
functional_des
Contributor III

Hi There,

I was unable to change the Baud rate in LPSPI1 (the only one I tried) and I tracked it down to this logic in fsl_lpspi.c -> LPSPI_MasterSetBaudRate()

((base->CR & LPSPI_CR_MEN_MASK) != 0U)

For whatever reason this always evaluates as false, resulting in us sticking with the default 500K baud. Commenting out that check resolves the problem. The comment above says 

"the LPSPI module needs to be disabled first, if enabled, return 0" but I'm not sure how to work around this since it always returns out and never resolves.

Here is my config: 

const lpspi_master_config_t LPSPI1_config = {
  .baudRate = 1000000UL,
  .bitsPerFrame = 8UL,
  .cpol = kLPSPI_ClockPolarityActiveHigh,
  .cpha = kLPSPI_ClockPhaseFirstEdge,
  .direction = kLPSPI_MsbFirst,
  .pcsToSckDelayInNanoSec = 1000UL,
  .lastSckToPcsDelayInNanoSec = 1000UL,
  .betweenTransferDelayInNanoSec = 1000UL,
  .whichPcs = kLPSPI_Pcs0,
  .pcsActiveHighOrLow = kLPSPI_PcsActiveHigh,
  .pinCfg = kLPSPI_SdiInSdoOut,
  .dataOutConfig = kLpspiDataOutRetained
};

 

0 项奖励
回复
2 回复数

559 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @functional_des ,

  You mean the following code always return 0, right?

kerryzhou_0-1658326710466.png

If yes, I think, you can use the SDK lpspi code to test it instead of your own configuration, then do the baudrate change and test it, whether still have this issues.

SDK_2_11_1_EVKB-MIMXRT1060\boards\evkmimxrt1060\driver_examples\lpspi\polling_b2b_transfer\master

If you can reproduce the issues with the SDK demo, just kindly let me know.

 

Best Regards,

kerry

 

0 项奖励
回复

553 次查看
functional_des
Contributor III

Yes that line always returns 0 and returns out. I will check out the example and let you know what I see