<?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>8-bit MicrocontrollersのトピックRe: SPI driver for Infineon Slave device</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/SPI-driver-for-Infineon-Slave-device/m-p/156847#M9077</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you need a driver for the SPI module, use Processor Expert.&lt;/P&gt;&lt;P&gt;It's worth you time to learn PE.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 07 Aug 2011 03:49:26 GMT</pubDate>
    <dc:creator>JimDon</dc:creator>
    <dc:date>2011-08-07T03:49:26Z</dc:date>
    <item>
      <title>SPI driver for Infineon Slave device</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/SPI-driver-for-Infineon-Slave-device/m-p/156846#M9076</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello, I am using infineon TLE 8104 low side driver as a slave in my application design, do any one have idea about writing SPI driver for this device with HCS08 MCU? Regards, Ajay&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Aug 2011 11:25:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/SPI-driver-for-Infineon-Slave-device/m-p/156846#M9076</guid>
      <dc:creator>Ajay2210</dc:creator>
      <dc:date>2011-08-06T11:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: SPI driver for Infineon Slave device</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/SPI-driver-for-Infineon-Slave-device/m-p/156847#M9077</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you need a driver for the SPI module, use Processor Expert.&lt;/P&gt;&lt;P&gt;It's worth you time to learn PE.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Aug 2011 03:49:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/SPI-driver-for-Infineon-Slave-device/m-p/156847#M9077</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2011-08-07T03:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: SPI driver for Infineon Slave device</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/SPI-driver-for-Infineon-Slave-device/m-p/156848#M9078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Ajay,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Making use of the SPI peripheral hardware as an SPI master&amp;nbsp;is the easy part.&amp;nbsp; The more difficult part is to understand the exact communications requirements of the SPI slave device, in this case the TLE8104E.&amp;nbsp; I will assume that you will use a relatively fast SPI clock rate, so there is&amp;nbsp;usually little justification in using interrupts for&amp;nbsp;master communications usage.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You will firstly need to initialise the SPI module as a master.&amp;nbsp; In addition to choosing a clock rate that is compatible with the slave, you will also need to select the CPHA and CPOL settings that the slave requires (see the attached file SPI.c, which would&amp;nbsp;be modified to suit).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The attached file SPI.c provides a very simple polling function that provides for simultaneously sending and receiving of&amp;nbsp;a single byte.&amp;nbsp; This is the only communications "driver" that is necessary.&amp;nbsp; You will then need to write additional functions that fulfil the communications details for the specific device, as described in its datasheet, and these&amp;nbsp;would call the SPI_trans() function as required.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For further simplification, you might setup the following macros:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;#define DUMMY&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;#define SPI_send(x)&amp;nbsp;(void)SPI_trans(x)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;#define SPI_recv()&amp;nbsp; SPI_trans(DUMMY)&amp;nbsp;&amp;nbsp;&amp;nbsp;// Received value is returned&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Aug 2011 20:28:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/SPI-driver-for-Infineon-Slave-device/m-p/156848#M9078</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2011-08-07T20:28:13Z</dc:date>
    </item>
    <item>
      <title>Re: SPI driver for Infineon Slave device</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/SPI-driver-for-Infineon-Slave-device/m-p/156849#M9079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Thanks for the reply. I will check with it&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Aug 2011 12:56:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/SPI-driver-for-Infineon-Slave-device/m-p/156849#M9079</guid>
      <dc:creator>Ajay2210</dc:creator>
      <dc:date>2011-08-10T12:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: SPI driver for Infineon Slave device</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/SPI-driver-for-Infineon-Slave-device/m-p/156850#M9080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I like the simplicity of your code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But to me it looks like your SPI function exits before the module is done finishing the last clock. If the chip select to another device is asserted right after the SPI function exits, that device might see an extra edge. This is especially true if you have&lt;/P&gt;&lt;P&gt;devices that need different CPOL settings on the same bus- nvrams and adc's seem to want different clock edges.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Shouldn't you also pole the the CLK output pin and make sure it has returned to its default state before you exit your SPI function?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I might be wrong, or the SPI module SPRF bit timing may have changed over the years... but let me know what you think.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Aug 2011 04:50:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/SPI-driver-for-Infineon-Slave-device/m-p/156850#M9080</guid>
      <dc:creator>PG1</dc:creator>
      <dc:date>2011-08-25T04:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: SPI driver for Infineon Slave device</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/SPI-driver-for-Infineon-Slave-device/m-p/156851#M9081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The SPRF flag will become set some time after the last "active" clock edge, and the received data is available.&amp;nbsp; If there is a further clock&amp;nbsp;transition to occur after the flag is set, it would normally be of no consequence since it would be an "inactive" edge.&amp;nbsp; I do not know whether this situation actually occurs.&amp;nbsp; It is certainly OK to raise the SS line as soon as the flag is set.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When swapping between two different&amp;nbsp;SPI devices that have&amp;nbsp;separate setup requirements, I think that it would be wise to firstly disable the SPI module, and to&amp;nbsp;then re-initialise&amp;nbsp;with the alternative setup, prior to the SS line being set to active low.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would&amp;nbsp;suspect that polling the clock pin may not work because, when the SPI module is enabled, the module will control the pin.&amp;nbsp; Although I have never actually&amp;nbsp;tried reading the pin status&amp;nbsp;as GPIO&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I notice that many SPI devices that require a 0:0 setting for CPOL:CPHA are also&amp;nbsp;compatible with a 1:1 setting.&amp;nbsp; This would normally be stated in their datasheet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Aug 2011 13:36:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/SPI-driver-for-Infineon-Slave-device/m-p/156851#M9081</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2011-08-25T13:36:06Z</dc:date>
    </item>
    <item>
      <title>Re: SPI driver for Infineon Slave device</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/SPI-driver-for-Infineon-Slave-device/m-p/156852#M9082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That is a good solution...disabling the SPI module and restarting it with new settings.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe you&amp;nbsp;can poll the clock. The HCS08 Peripheral Module quick reference HCS08QRUG.PDF shows SPI code where&lt;/P&gt;&lt;P&gt;they wait for the clock to go to its default (at rest, initial, nominal,inactive) logic level by polling the pin with SCLK. (although&amp;nbsp;sitting and waiting &amp;nbsp;for the clock to become inactive in the middle of an ISR is not a good thing)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://cache.freescale.com/files/microcontrollers/doc/user_guide/HCS08QRUG.pdf?fsrch=1&amp;amp;sr=2" rel="nofollow" target="_blank"&gt;Peripheral Quick Reference&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Aug 2011 01:27:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/SPI-driver-for-Infineon-Slave-device/m-p/156852#M9082</guid>
      <dc:creator>PG1</dc:creator>
      <dc:date>2011-08-26T01:27:32Z</dc:date>
    </item>
  </channel>
</rss>

