QSPI Buad Rate divisor in polled mcf5xxx_qspi.c

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

QSPI Buad Rate divisor in polled mcf5xxx_qspi.c

817 Views
drkhes
Contributor I

It looks like the baud rate divisor is miscalculated for polled qspi in mqx 3.6.2.

 

In the file mqx/source/io/spi/polled/spi_pol_mcf5xxx_qspi.c the function  _mcf5xxx_qspi_find_baudrate()

The divisor is calculated as

    div=(clock + (baudrate >> 1)) / baudrate;

I think it should be

   div=clock / (baudrate << 1);

 

I am using the mfc52223 and the reference manual states that the calculation for the divisor is

QMR[BAUD] = clock / (2 × [desired QSPI_CLK baud rate]). We have the processor running on 80,000,000hz, and from my understanding the bus clock is 40,000,000hz. So if I want a 4M baud rate, I compute I need a divisor of 5, but the_mcf5xxx_qspi_find_baudrate() function computes a divisor of 10 when I pass in bus clock speed of 40Mhz and 4M baud rate.

What am I missing?

Thanks

Donald

 

 

Tags (2)
0 Kudos
2 Replies

375 Views
PetrM
Senior Contributor I

You are right, thank you for reporting this.

The fix will be available in the next release.

 

PetrM

 

0 Kudos

375 Views
drkhes
Contributor I

This also causes IO_IOCTL_SPI_GET_BAUD to be invalid also then,

 

near line 326

 else *param_ptr = (uint_32)((io_info_ptr->INIT.CLOCK_SPEED) / val);

needs to change to

 else *param_ptr = (uint_32)((io_info_ptr->INIT.CLOCK_SPEED) / val/2);

 

 

Donald

 

0 Kudos