<?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 Re: How to send SPI data on register level in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/How-to-send-SPI-data-on-register-level/m-p/657233#M100773</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everybody,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am facing quite the same issue : I want to use the SPI (ECSPI1) with mmap but when I try to read from the registers (with /dev/mem), linux hangs and I have to reboot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you solve your problem ? How did you manage to set the registers with mmap ?&lt;/P&gt;&lt;P&gt;Any advice would be welcome.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clement&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Feb 2017 08:45:40 GMT</pubDate>
    <dc:creator>cplaton</dc:creator>
    <dc:date>2017-02-14T08:45:40Z</dc:date>
    <item>
      <title>How to send SPI data on register level</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/How-to-send-SPI-data-on-register-level/m-p/657227#M100767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm trying to get data transferred over SPI in linux and I want to try if I can acces it faster with the aid of mmap. I have set all the required register for the SPI to operate. With the following code I try to send data:&lt;/P&gt;&lt;P&gt;for(i=0;i&amp;lt;50;i++)&lt;BR /&gt; {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;spi_pointer[0][0x01] = 0xAA; //set data&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;spi_pointer[0][0x02] |= 0x4; //set xch bit to start burst transfer&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;while(((spi_pointer[0][0x02]&amp;gt;&amp;gt;2) &amp;amp; 1) == 1); //wait until burst is finished&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Only when I try to measure the CLK with an oscilloscope, I don't get any signal at all. Also when looking in the status register it seems that there is no data in the TXFIFO register. Is there something that i'm missing?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Remco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2017 10:36:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/How-to-send-SPI-data-on-register-level/m-p/657227#M100767</guid>
      <dc:creator>remcohardeveld</dc:creator>
      <dc:date>2017-01-31T10:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to send SPI data on register level</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/How-to-send-SPI-data-on-register-level/m-p/657228#M100768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you first configured the IOMUX for the selected SPI signals? Please check.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Artur&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2017 10:23:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/How-to-send-SPI-data-on-register-level/m-p/657228#M100768</guid>
      <dc:creator>art</dc:creator>
      <dc:date>2017-02-06T10:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to send SPI data on register level</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/How-to-send-SPI-data-on-register-level/m-p/657229#M100769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think they are OK because when I use the default driver i get a good output. And I use those settings when I try to output mine. So I use the correct interface for it to do the setting only I want to have a faster SPI access time so I put my data directly to the registers.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I will verify the IOMUX settings. I will post later the results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Remco&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2017 13:00:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/How-to-send-SPI-data-on-register-level/m-p/657229#M100769</guid>
      <dc:creator>remcohardeveld</dc:creator>
      <dc:date>2017-02-06T13:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to send SPI data on register level</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/How-to-send-SPI-data-on-register-level/m-p/657230#M100770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have checked the IOMUX registery corresponding to the pins i use, and they are correctly set:&lt;/P&gt;&lt;P&gt;IOMUXC_SW_MUX_CTL_PAD_CSI0_DATA04 = 2 //ALT2 — Select signal ECSPI1_SCLK&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;IOMUXC_SW_MUX_CTL_PAD_CSI0_DATA04 = 2 //ALT2 — Select signal ECSPI1_MOSI&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;IOMUXC_SW_MUX_CTL_PAD_CSI0_DATA04 = 2 //ALT2 — Select signal ECSPI1_MISO&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;IOMUXC_SW_MUX_CTL_PAD_CSI0_DATA04 = 5 //101 ALT5 — Select signal GPIO5_IO25 (use GPIO as SS)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I also have checked the whole SPI config and they are also correct (same as a working SPI). Also check if the XCH bit is set, only i suspect &amp;nbsp;that that goes to fast to check.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Do you have any other idea where I can check for?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Remco&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Feb 2017 14:02:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/How-to-send-SPI-data-on-register-level/m-p/657230#M100770</guid>
      <dc:creator>remcohardeveld</dc:creator>
      <dc:date>2017-02-06T14:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to send SPI data on register level</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/How-to-send-SPI-data-on-register-level/m-p/657231#M100771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you sure you make all the SPI controller writes and reads on the correct physical addresses? Please double-check.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, try to make all the things manually, using the 'memtool' command line tool that is located in the /unit_tests directory of the default Linux BSP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Artur&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Feb 2017 09:16:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/How-to-send-SPI-data-on-register-level/m-p/657231#M100771</guid>
      <dc:creator>art</dc:creator>
      <dc:date>2017-02-07T09:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to send SPI data on register level</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/How-to-send-SPI-data-on-register-level/m-p/657232#M100772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am 95% sure that I'm messing with the correct registers: These are the hardware address that I use (I get access to them with mmap to /dev/mem):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;0x02008000&lt;SPAN&gt; -&amp;gt;&amp;nbsp;&lt;/SPAN&gt;ECSPI1_RXDATA)&lt;/P&gt;&lt;P&gt;0x02008004&lt;SPAN&gt; -&amp;gt;&amp;nbsp;ECSPI1_TXDATA)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;0x02008008&lt;SPAN&gt; -&amp;gt;&amp;nbsp;ECSPI1_CONREG&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;0x0200800C&lt;SPAN&gt; -&amp;gt;&amp;nbsp;ECSPI1_CONFIGREG&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;0x02008010&lt;SPAN&gt; -&amp;gt;&amp;nbsp;ECSPI1_INTREG&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;0x02008014&lt;SPAN&gt; -&amp;gt;&amp;nbsp;ECSPI1_DMAREG&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;0x02008018&lt;SPAN&gt; -&amp;gt;&amp;nbsp;ECSPI1_STATREG&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;0x0200801C&lt;SPAN&gt; -&amp;gt;&amp;nbsp;ECSPI1_PERIODREG&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;0x02008020&lt;SPAN&gt; -&amp;gt;&amp;nbsp;ECSPI1_TESTREG&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;0x02008040 -&amp;gt;&amp;nbsp;ECSPI1_MSGDATA&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also when I use the memtool and read from the address that I use (like those above) I get the exact same results as when I do it with my code. Thus so far as I know I do it wright.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I initiate the transmit with setting XCH I still don't see any output. Also when writing to TXDATA I don't see any change in the TESTREG. I expected to see 0x01 to indicate that there is now 1 a 32-bit data package ready in the FIFO register.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Feb 2017 10:57:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/How-to-send-SPI-data-on-register-level/m-p/657232#M100772</guid>
      <dc:creator>remcohardeveld</dc:creator>
      <dc:date>2017-02-07T10:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to send SPI data on register level</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/How-to-send-SPI-data-on-register-level/m-p/657233#M100773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everybody,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am facing quite the same issue : I want to use the SPI (ECSPI1) with mmap but when I try to read from the registers (with /dev/mem), linux hangs and I have to reboot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you solve your problem ? How did you manage to set the registers with mmap ?&lt;/P&gt;&lt;P&gt;Any advice would be welcome.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clement&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2017 08:45:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/How-to-send-SPI-data-on-register-level/m-p/657233#M100773</guid>
      <dc:creator>cplaton</dc:creator>
      <dc:date>2017-02-14T08:45:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to send SPI data on register level</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/How-to-send-SPI-data-on-register-level/m-p/657234#M100774</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Clement platon,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have succesfully accesed the registers directly in both WEC2013 and Linux. For Linux I had the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;unsigned int *Offset_register_SPI[10] = {};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void init_register_SPI()&lt;BR /&gt;{&lt;BR /&gt; void *spi_map = 0;&lt;BR /&gt; void *CCGR_map = 0;&lt;BR /&gt; int mem_fd;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if ((mem_fd = open("/dev/mem", O_RDWR|O_SYNC) ) &amp;lt; 0)// open /dev/mem //&lt;BR /&gt; {&lt;BR /&gt; printf("can't open /dev/mem \n");&lt;BR /&gt; exit(-1);&lt;BR /&gt; }&lt;BR /&gt; spi_map = mmap(NULL,4,PROT_READ|PROT_WRITE,MAP_SHARED,mem_fd,0x0200C000);&lt;BR /&gt; if (spi_map == MAP_FAILED)&lt;BR /&gt; {&lt;BR /&gt; printf("mmap error\n");//errno also set!&lt;BR /&gt; exit(-1);&lt;BR /&gt; }&lt;BR /&gt; Offset_register_SPI[0] = spi_map + 0x00;// Always use volatile pointer!&lt;BR /&gt; Offset_register_SPI[1] = spi_map + 0x04;&lt;BR /&gt; Offset_register_SPI[2] = spi_map + 0x08;&lt;BR /&gt; Offset_register_SPI[3] = spi_map + 0x0C;&lt;BR /&gt; Offset_register_SPI[4] = spi_map + 0x10;&lt;BR /&gt; Offset_register_SPI[5] = spi_map + 0x14;&lt;BR /&gt; Offset_register_SPI[6] = spi_map + 0x18;&lt;BR /&gt; Offset_register_SPI[7] = spi_map + 0x1C;&lt;BR /&gt; Offset_register_SPI[8] = spi_map + 0x20;&lt;BR /&gt; Offset_register_SPI[9] = spi_map + 0x40;&lt;BR /&gt; close(mem_fd);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To read and write from the registers you have to use *. Also keep in mind to get it fully working you have to enable the ECSPI clock and set IOMUX correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope that this can help you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Feb 2017 07:36:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/How-to-send-SPI-data-on-register-level/m-p/657234#M100774</guid>
      <dc:creator>remcohardeveld</dc:creator>
      <dc:date>2017-02-16T07:36:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to send SPI data on register level</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/How-to-send-SPI-data-on-register-level/m-p/657235#M100775</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your reply,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Indeed, the ECSPI clock was disabled. It works fine now !&lt;/P&gt;&lt;P&gt;Thanks a lot for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clement&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Feb 2017 08:30:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/How-to-send-SPI-data-on-register-level/m-p/657235#M100775</guid>
      <dc:creator>cplaton</dc:creator>
      <dc:date>2017-02-17T08:30:34Z</dc:date>
    </item>
  </channel>
</rss>

