<?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 LPC54628 Can EMC peripheral be used for DPRAM Semaphore access in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54628-Can-EMC-peripheral-be-used-for-DPRAM-Semaphore-access/m-p/1161610#M42442</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I was successful in writing and reading data from external Dual Port RAM 70V261 using the EMC peripheral of LPC54628.&lt;/P&gt;&lt;P&gt;Now I need to use the hardware semaphore functionality of DPRAM. As I was going through the datasheet of DPRAM, I noticed that to use its semaphore functionality, the state of EMC control pins need to be a bit different from normal read/write accesses.&lt;/P&gt;&lt;P&gt;For example,&lt;/P&gt;&lt;P&gt;a) for one type of SEMAPHORE access, the /CE (chip enable) pin needs to be logic HIGH for both read/write accesses. However for normal data read/write access, /CE pin needs to be logic LOW.&lt;/P&gt;&lt;P&gt;b) In another type of SEMAPHORE access, the byte lane select lanes BLSNx of EMC peripheral (which is UB/LB for DPRAM) need to be logic HIGH. However for normal data read/write access BLSNx of EMC need to be logic LOW all the time (since I am using the DPRAM in two byte/ 16-bit mode).&lt;/P&gt;&lt;P&gt;c) For semaphore writes the RW (read/write) pin needs to have a rising edge after the addresses and data out lines become active. However for normal data read/write accesses, the RW pin needs to be in steady state (logic low for Writes and logic high for Reads).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Query-1:&lt;/STRONG&gt; Is there a way to tell the EMC peripheral of LPC54628 that I am accessing a semaphore and hence the control pins need to be handled in a different way from normal accesses? If not, does it mean that I have to configure the relevant pins of the EMC as GPIOs and control them in my code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Query-2:&lt;/STRONG&gt; Assuming I need to configure the pins /CE and /RW as GPIO and control them from my code, how can I generate a RISING EDGE on RW pin for semaphore writes &lt;STRONG&gt;AFTER&lt;/STRONG&gt;&amp;nbsp; the address &amp;amp; data become active? WIll the code shown below work?&lt;/P&gt;&lt;PRE&gt;&lt;STRONG&gt;void DPRAM_GPIO_Semaphore_Write(void)&lt;/STRONG&gt;{&lt;BR /&gt;temp16_1 = 0x00; DPRAM_base_add = 0x80000000; DPRAM_offset = 0x1;&lt;BR /&gt;&lt;BR /&gt;GPIO-&amp;gt;B[0][EMC_CE_R] = 1;&lt;BR /&gt;GPIO-&amp;gt;B[1][EMC_SEM_R] = 0;&lt;BR /&gt;&lt;EM&gt;GPIO-&amp;gt;B[0][EMC_RW_R] = 0; // Initially keep this low so that a rising edge can be generated on this pin soon after.&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;*(uint32_t *)(DPRAM_base_add + DPRAM_offset) = temp16_1;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;GPIO-&amp;gt;B[0][EMC_RW_R] = 1;&lt;/EM&gt; // This is shown as rising edge in datasheet&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;void DPRAM_GPIO_Semaphore_Read(void)&lt;/STRONG&gt;{&lt;BR /&gt;temp16_2 = 0x00; DPRAM_base_add = 0x80000000; DPRAM_offset = 0x1;&lt;BR /&gt;&lt;BR /&gt;GPIO-&amp;gt;B[0][EMC_CE_R] = 1;&lt;BR /&gt;GPIO-&amp;gt;B[1][EMC_SEM_R] = 0;&lt;BR /&gt;GPIO-&amp;gt;B[0][EMC_RW_R] = 1; &lt;BR /&gt;&lt;BR /&gt;temp16_2 = *(uint32_t *)(DPRAM_base_add + DPRAM_offset);&lt;BR /&gt;&lt;BR /&gt;PRINTF("0x%x at 0x%x \r\n", temp16_2, (DPRAM_base_add + DPRAM_offset));&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2.JPG" style="width: 874px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/126587i3BCC867ACF04631E/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.JPG" alt="2.JPG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.JPG" style="width: 920px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/126588i9EE22CDE6B415A0F/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.JPG" alt="1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 01 Oct 2020 04:58:07 GMT</pubDate>
    <dc:creator>aswinprabhu</dc:creator>
    <dc:date>2020-10-01T04:58:07Z</dc:date>
    <item>
      <title>LPC54628 Can EMC peripheral be used for DPRAM Semaphore access</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54628-Can-EMC-peripheral-be-used-for-DPRAM-Semaphore-access/m-p/1161610#M42442</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I was successful in writing and reading data from external Dual Port RAM 70V261 using the EMC peripheral of LPC54628.&lt;/P&gt;&lt;P&gt;Now I need to use the hardware semaphore functionality of DPRAM. As I was going through the datasheet of DPRAM, I noticed that to use its semaphore functionality, the state of EMC control pins need to be a bit different from normal read/write accesses.&lt;/P&gt;&lt;P&gt;For example,&lt;/P&gt;&lt;P&gt;a) for one type of SEMAPHORE access, the /CE (chip enable) pin needs to be logic HIGH for both read/write accesses. However for normal data read/write access, /CE pin needs to be logic LOW.&lt;/P&gt;&lt;P&gt;b) In another type of SEMAPHORE access, the byte lane select lanes BLSNx of EMC peripheral (which is UB/LB for DPRAM) need to be logic HIGH. However for normal data read/write access BLSNx of EMC need to be logic LOW all the time (since I am using the DPRAM in two byte/ 16-bit mode).&lt;/P&gt;&lt;P&gt;c) For semaphore writes the RW (read/write) pin needs to have a rising edge after the addresses and data out lines become active. However for normal data read/write accesses, the RW pin needs to be in steady state (logic low for Writes and logic high for Reads).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Query-1:&lt;/STRONG&gt; Is there a way to tell the EMC peripheral of LPC54628 that I am accessing a semaphore and hence the control pins need to be handled in a different way from normal accesses? If not, does it mean that I have to configure the relevant pins of the EMC as GPIOs and control them in my code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Query-2:&lt;/STRONG&gt; Assuming I need to configure the pins /CE and /RW as GPIO and control them from my code, how can I generate a RISING EDGE on RW pin for semaphore writes &lt;STRONG&gt;AFTER&lt;/STRONG&gt;&amp;nbsp; the address &amp;amp; data become active? WIll the code shown below work?&lt;/P&gt;&lt;PRE&gt;&lt;STRONG&gt;void DPRAM_GPIO_Semaphore_Write(void)&lt;/STRONG&gt;{&lt;BR /&gt;temp16_1 = 0x00; DPRAM_base_add = 0x80000000; DPRAM_offset = 0x1;&lt;BR /&gt;&lt;BR /&gt;GPIO-&amp;gt;B[0][EMC_CE_R] = 1;&lt;BR /&gt;GPIO-&amp;gt;B[1][EMC_SEM_R] = 0;&lt;BR /&gt;&lt;EM&gt;GPIO-&amp;gt;B[0][EMC_RW_R] = 0; // Initially keep this low so that a rising edge can be generated on this pin soon after.&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;*(uint32_t *)(DPRAM_base_add + DPRAM_offset) = temp16_1;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;GPIO-&amp;gt;B[0][EMC_RW_R] = 1;&lt;/EM&gt; // This is shown as rising edge in datasheet&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;void DPRAM_GPIO_Semaphore_Read(void)&lt;/STRONG&gt;{&lt;BR /&gt;temp16_2 = 0x00; DPRAM_base_add = 0x80000000; DPRAM_offset = 0x1;&lt;BR /&gt;&lt;BR /&gt;GPIO-&amp;gt;B[0][EMC_CE_R] = 1;&lt;BR /&gt;GPIO-&amp;gt;B[1][EMC_SEM_R] = 0;&lt;BR /&gt;GPIO-&amp;gt;B[0][EMC_RW_R] = 1; &lt;BR /&gt;&lt;BR /&gt;temp16_2 = *(uint32_t *)(DPRAM_base_add + DPRAM_offset);&lt;BR /&gt;&lt;BR /&gt;PRINTF("0x%x at 0x%x \r\n", temp16_2, (DPRAM_base_add + DPRAM_offset));&lt;BR /&gt;}&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2.JPG" style="width: 874px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/126587i3BCC867ACF04631E/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.JPG" alt="2.JPG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.JPG" style="width: 920px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/126588i9EE22CDE6B415A0F/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.JPG" alt="1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Oct 2020 04:58:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54628-Can-EMC-peripheral-be-used-for-DPRAM-Semaphore-access/m-p/1161610#M42442</guid>
      <dc:creator>aswinprabhu</dc:creator>
      <dc:date>2020-10-01T04:58:07Z</dc:date>
    </item>
  </channel>
</rss>

