<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Issues with multiple mode QSPI devices using mfc52223 and spi_pol_mcf5xxx_qspi.c in MQX Software Solutions</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/Issues-with-multiple-mode-QSPI-devices-using-mfc52223-and-spi/m-p/166989#M1675</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;FONT color="#333333" size="2"&gt;I have encountered a weakness in the bsp architecture when using multiple kinds of modes in&amp;nbsp;spi devices. The basic issue is this, in the initialization for spi devices in init_spi.c&amp;nbsp;one passes in clock phase and polarity through&amp;nbsp;the MCF5XXX_QSPI_INIT_STRUCT structure. If you have two devices with different phase/polarity, the you must reset the mode with an ioctl before each read/write ioctl. One must do this because the last phase/polarity set is what is used, not what a specfic device is configured with. This also is true of baud rate if my code reading is correct. In addition,&amp;nbsp;it would be nice if the&amp;nbsp;FRAMESIZE was added to the MCF5XXX_QSPI_INIT_STRUCT&amp;nbsp;so that it could be stored&amp;nbsp;and used.&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333" size="2"&gt;An application in theory could in one task could set the phase/polarity, be swapped out, have another task set phase/polarity, be swapped out, then have the first task swap&amp;nbsp;back in and&amp;nbsp;send its data with the incorrect settings. Even without the task switching issues, it is combersome to have to always set the phase/polarity before each read/write operation.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333" size="2"&gt;I have modified my spi_pol_mcf5xxx_qspi.c function _mcf5xxx_qspi_polled_tx_rx()&amp;nbsp;to explicitly call the ioctl to set mode and baud&amp;nbsp;IO_IOCTL_SPI_SET_MODE and IO_IOCTL_SPI_SET_BAUD before transmitting.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333" size="2"&gt;Around line 668 I added&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333" size="2"&gt;if ( SPI_OK != _mcf5xxx_qspi_polled_ioctl( io_info_ptr, IO_IOCTL_SPI_SET_MODE, &amp;amp;io_info_ptr-&amp;gt;INIT.CLOCK_POL_PHASE, 0 ) )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;BR /&gt;if ( SPI_OK != _mcf5xxx_qspi_polled_ioctl( io_info_ptr, IO_IOCTL_SPI_SET_BAUD, &amp;amp;io_info_ptr-&amp;gt;INIT.BAUD_RATE, 0 ) )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333" size="2"&gt;If the FRAMESIZE was stored, I would set it here also.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333" size="2"&gt;Donald&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333" size="2"&gt;M8R-jw5952 at mailinator dot com&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 04 Dec 2010 00:40:44 GMT</pubDate>
    <dc:creator>drkhes</dc:creator>
    <dc:date>2010-12-04T00:40:44Z</dc:date>
    <item>
      <title>Issues with multiple mode QSPI devices using mfc52223 and spi_pol_mcf5xxx_qspi.c</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Issues-with-multiple-mode-QSPI-devices-using-mfc52223-and-spi/m-p/166989#M1675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;FONT color="#333333" size="2"&gt;I have encountered a weakness in the bsp architecture when using multiple kinds of modes in&amp;nbsp;spi devices. The basic issue is this, in the initialization for spi devices in init_spi.c&amp;nbsp;one passes in clock phase and polarity through&amp;nbsp;the MCF5XXX_QSPI_INIT_STRUCT structure. If you have two devices with different phase/polarity, the you must reset the mode with an ioctl before each read/write ioctl. One must do this because the last phase/polarity set is what is used, not what a specfic device is configured with. This also is true of baud rate if my code reading is correct. In addition,&amp;nbsp;it would be nice if the&amp;nbsp;FRAMESIZE was added to the MCF5XXX_QSPI_INIT_STRUCT&amp;nbsp;so that it could be stored&amp;nbsp;and used.&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333" size="2"&gt;An application in theory could in one task could set the phase/polarity, be swapped out, have another task set phase/polarity, be swapped out, then have the first task swap&amp;nbsp;back in and&amp;nbsp;send its data with the incorrect settings. Even without the task switching issues, it is combersome to have to always set the phase/polarity before each read/write operation.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333" size="2"&gt;I have modified my spi_pol_mcf5xxx_qspi.c function _mcf5xxx_qspi_polled_tx_rx()&amp;nbsp;to explicitly call the ioctl to set mode and baud&amp;nbsp;IO_IOCTL_SPI_SET_MODE and IO_IOCTL_SPI_SET_BAUD before transmitting.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333" size="2"&gt;Around line 668 I added&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333" size="2"&gt;if ( SPI_OK != _mcf5xxx_qspi_polled_ioctl( io_info_ptr, IO_IOCTL_SPI_SET_MODE, &amp;amp;io_info_ptr-&amp;gt;INIT.CLOCK_POL_PHASE, 0 ) )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;BR /&gt;if ( SPI_OK != _mcf5xxx_qspi_polled_ioctl( io_info_ptr, IO_IOCTL_SPI_SET_BAUD, &amp;amp;io_info_ptr-&amp;gt;INIT.BAUD_RATE, 0 ) )&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333" size="2"&gt;If the FRAMESIZE was stored, I would set it here also.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333" size="2"&gt;Donald&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333" size="2"&gt;M8R-jw5952 at mailinator dot com&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#333333" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Dec 2010 00:40:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Issues-with-multiple-mode-QSPI-devices-using-mfc52223-and-spi/m-p/166989#M1675</guid>
      <dc:creator>drkhes</dc:creator>
      <dc:date>2010-12-04T00:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with multiple mode QSPI devices using mfc52223 and spi_pol_mcf5xxx_qspi.c</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Issues-with-multiple-mode-QSPI-devices-using-mfc52223-and-spi/m-p/166990#M1676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is the reason why the spi driver cannot be opened&amp;nbsp;multiple times simultaneously (in&amp;nbsp;several&amp;nbsp;tasks).&lt;/P&gt;&lt;P&gt;It is low level driver, it should be used in one (spi communication) task only and this task should manage multiple connections/protocols/stacks for the other tasks.&lt;/P&gt;&lt;P&gt;The initialization structure contains just default settings, in multiple device mode it's practically useless. But you're right, it may be extended by other parameters.&lt;/P&gt;&lt;P&gt;Your modification is specific for your use case, the driver should stay universal - as you wrote, you can call the right IOCTL command anytime you want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PetrM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Dec 2010 22:18:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Issues-with-multiple-mode-QSPI-devices-using-mfc52223-and-spi/m-p/166990#M1676</guid>
      <dc:creator>PetrM</dc:creator>
      <dc:date>2010-12-06T22:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with multiple mode QSPI devices using mfc52223 and spi_pol_mcf5xxx_qspi.c</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Issues-with-multiple-mode-QSPI-devices-using-mfc52223-and-spi/m-p/166991#M1677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well that is just unacceptable. It can be better. I have already re-written the low level driver to support multiple types of spi devices. I don't believe it is yet task safe, but it will be when I am done.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is not the correct way to represent a device as you have attempted to in this mqx/bsp environment. If you want to design the abstraction between the application and device with file handles, one better be able to use a file handle without regards to other operations in the system.&amp;nbsp; One must not be limited to using those file handles in a single thread/task because they are all on the same bus and require extra ioctl calls because some other part of the application last used the bus.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is weak design. Full of holes. My evaluation of this system is not good.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Dec 2010 21:32:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Issues-with-multiple-mode-QSPI-devices-using-mfc52223-and-spi/m-p/166991#M1677</guid>
      <dc:creator>drkhes</dc:creator>
      <dc:date>2010-12-09T21:32:38Z</dc:date>
    </item>
  </channel>
</rss>

