<?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>LPC Microcontrollers中的主题 Re: LPC17xx UART1</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC17xx-UART1/m-p/1410518#M47853</link>
    <description>&lt;P&gt;Yeah, Alex, it looks like you need a cast to (LPC_UART_TypeDef) on lines 165 and 166:&lt;/P&gt;&lt;PRE&gt;UART_Init( (LPC_UART_TypeDef *)LPC_UART1,&amp;amp;uartConfig);&lt;BR /&gt;UART_TxCmd( (LPC_UART_TypeDef *)LPC_UART1,ENABLE);&lt;/PRE&gt;&lt;P&gt;For some reason, in whatever version of the tool you're using, uart1 is treated differently than the other uarts. &amp;nbsp;You can see it here, on line 221 of lpc17xx_uart.c that you included:&lt;/P&gt;&lt;PRE&gt; if(((LPC_UART1_TypeDef *)UARTx) == LPC_UART1)&lt;/PRE&gt;&lt;P&gt;All the other instances of uart default to&amp;nbsp;LPC_UART_TypeDef. &amp;nbsp;Make those typecasts, above, and it *should* work. &amp;nbsp;You'll need to typecast&amp;nbsp;LPC_UART1 every time you use it, I'd imagine.&lt;/P&gt;</description>
    <pubDate>Tue, 08 Feb 2022 20:49:35 GMT</pubDate>
    <dc:creator>aaronminner</dc:creator>
    <dc:date>2022-02-08T20:49:35Z</dc:date>
    <item>
      <title>LPC17xx UART1</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC17xx-UART1/m-p/1409238#M47823</link>
      <description>&lt;P&gt;Hello, my code works with UART3 and I just want to add UART1 to my code and I use the same piece of code for initializing UART1 that I used for UART3, however I faced this error: #167: argument of type "LPC_UART1_TypeDef *" is incompatible with parameter of type "LPC_UART_TypeDef *".&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was wondering if you help me resolve this issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;&lt;P&gt;Here is the part of the code I used:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;uartPinSel.Funcnum=PINSEL_FUNC_2;&lt;BR /&gt;uartPinSel.OpenDrain=PINSEL_PINMODE_NORMAL;&lt;BR /&gt;uartPinSel.Pinmode=PINSEL_PINMODE_TRISTATE;&lt;BR /&gt;uartPinSel.Pinnum=0;&lt;BR /&gt;uartPinSel.Portnum=0;&lt;BR /&gt;&lt;BR /&gt;PINSEL_ConfigPin(&amp;amp;uartPinSel);&lt;BR /&gt;uartPinSel.Pinnum=1;&lt;BR /&gt;PINSEL_ConfigPin(&amp;amp;uartPinSel);&lt;BR /&gt;&lt;BR /&gt;uartConfig.Baud_rate=115200;&lt;BR /&gt;uartConfig.Databits=UART_DATABIT_8;&lt;BR /&gt;uartConfig.Parity=UART_PARITY_NONE;&lt;BR /&gt;uartConfig.Stopbits=UART_STOPBIT_1;&lt;BR /&gt;&lt;BR /&gt;UART_Init(LPC_UART3,&amp;amp;uartConfig);&lt;BR /&gt;UART_TxCmd(LPC_UART3,ENABLE);&lt;BR /&gt;&lt;BR /&gt;UART_IntConfig(LPC_UART3,UART_INTCFG_RBR,ENABLE);&lt;BR /&gt;NVIC_EnableIRQ(UART3_IRQn);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;uartPinSel.Funcnum=PINSEL_FUNC_2;&lt;BR /&gt;uartPinSel.OpenDrain=PINSEL_PINMODE_NORMAL;&lt;BR /&gt;uartPinSel.Pinmode=PINSEL_PINMODE_TRISTATE;&lt;BR /&gt;uartPinSel.Pinnum=0;&lt;BR /&gt;uartPinSel.Portnum=2;&lt;BR /&gt;&lt;BR /&gt;PINSEL_ConfigPin(&amp;amp;uartPinSel);&lt;BR /&gt;uartPinSel.Pinnum=1;&lt;BR /&gt;PINSEL_ConfigPin(&amp;amp;uartPinSel);&lt;BR /&gt;&lt;BR /&gt;uartConfig.Baud_rate=38400;&lt;BR /&gt;uartConfig.Databits=UART_DATABIT_8;&lt;BR /&gt;uartConfig.Parity=UART_PARITY_NONE;&lt;BR /&gt;uartConfig.Stopbits=UART_STOPBIT_1;&lt;BR /&gt;&lt;BR /&gt;UART_Init(LPC_UART1,&amp;amp;uartConfig);&lt;BR /&gt;UART_TxCmd(LPC_UART1,ENABLE);&lt;/P&gt;</description>
      <pubDate>Sun, 06 Feb 2022 05:18:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC17xx-UART1/m-p/1409238#M47823</guid>
      <dc:creator>Alex_2221</dc:creator>
      <dc:date>2022-02-06T05:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: LPC17xx UART1</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC17xx-UART1/m-p/1409255#M47825</link>
      <description>&lt;P&gt;Can you show us the declaration of "&lt;FONT color="#FF0000"&gt;uartConfig&lt;/FONT&gt;"? It might be that you just need a typecast for "&lt;FONT color="#FF0000"&gt;const uart_config_t *&lt;/FONT&gt;".&lt;/P&gt;</description>
      <pubDate>Sun, 06 Feb 2022 07:24:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC17xx-UART1/m-p/1409255#M47825</guid>
      <dc:creator>aaronminner</dc:creator>
      <dc:date>2022-02-06T07:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: LPC17xx UART1</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC17xx-UART1/m-p/1409258#M47826</link>
      <description>&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/142540"&gt;@aaronminner&lt;/a&gt;&amp;nbsp;Here uartConfig is declared. Though I uploaded the c file so that you can take a look at the code better if there's something that I'm missing here.&lt;/P&gt;&lt;P&gt;&amp;nbsp; PINSEL_CFG_Type adcpinsel;&lt;/P&gt;&lt;P&gt;PINSEL_CFG_Type uartPinSel;&lt;/P&gt;&lt;P&gt;UART_CFG_Type uartConfig;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Feb 2022 09:39:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC17xx-UART1/m-p/1409258#M47826</guid>
      <dc:creator>Alex_2221</dc:creator>
      <dc:date>2022-02-06T09:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: LPC17xx UART1</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC17xx-UART1/m-p/1409278#M47829</link>
      <description>&lt;P&gt;Two things:&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;LPC_UART1 should translate to a memory address, like this - but different in your case since this is for a FRDM66F and the memory locations are likely not the same:&lt;/P&gt;&lt;PRE&gt;/** Peripheral UART1 base address */&lt;BR /&gt;&lt;SPAN&gt;#define&lt;/SPAN&gt; UART1_BASE &lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;(0x4006B000u)&lt;BR /&gt;/** Peripheral UART1 base pointer */&lt;BR /&gt;&lt;SPAN&gt;#define&lt;/SPAN&gt; UART1&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;((UART_Type *)UART1_BASE)&lt;/PRE&gt;&lt;P&gt;Make sure&amp;nbsp;LPC_UART3 and&amp;nbsp;LPC_UART1 resolve to addresses somewhat like that.&lt;/P&gt;&lt;P&gt;2. You should use separate "config" variables for the different peripherals, even if they're of the same UART type. &amp;nbsp;So create "uartConfig3" and a "uartConfig1" variables and pass those in respectively. &amp;nbsp;The memory locations are used in the background, and having one variable used for two instances could lead to confusion in data handling.&lt;/P&gt;</description>
      <pubDate>Sun, 06 Feb 2022 16:40:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC17xx-UART1/m-p/1409278#M47829</guid>
      <dc:creator>aaronminner</dc:creator>
      <dc:date>2022-02-06T16:40:45Z</dc:date>
    </item>
    <item>
      <title>Re: LPC17xx UART1</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC17xx-UART1/m-p/1410030#M47847</link>
      <description>&lt;P&gt;Hi, Alex,&lt;/P&gt;
&lt;P&gt;do you know&amp;nbsp; where the structure UART_CFG_Type&amp;nbsp; is defined? It appears that the UART_CFG_Type structure is not derfined.&lt;/P&gt;
&lt;P&gt;Pls have a check&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Xiangjun Rong&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 06:16:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC17xx-UART1/m-p/1410030#M47847</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2022-02-08T06:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: LPC17xx UART1</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC17xx-UART1/m-p/1410049#M47848</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&amp;gt; &lt;EM&gt;error: #167: argument of type "&lt;STRONG&gt;LPC_UART&lt;FONT color="#FF0000"&gt;1&lt;/FONT&gt;_TypeDef&lt;/STRONG&gt; *" is incompatible with parameter of type "&lt;STRONG&gt;LPC_UART_TypeDef&lt;/STRONG&gt; *"&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;These are different types, it seems. I suppose a type cast should work, but I would check before what the differences are.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 06:47:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC17xx-UART1/m-p/1410049#M47848</guid>
      <dc:creator>frank_m</dc:creator>
      <dc:date>2022-02-08T06:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: LPC17xx UART1</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC17xx-UART1/m-p/1410502#M47852</link>
      <description>&lt;P&gt;Hi, I think it's defined in lpc17xx_uart.h driver file. Because when I type F12 it brings me to that file. I added that file here&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 20:25:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC17xx-UART1/m-p/1410502#M47852</guid>
      <dc:creator>Alex_2221</dc:creator>
      <dc:date>2022-02-08T20:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: LPC17xx UART1</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC17xx-UART1/m-p/1410518#M47853</link>
      <description>&lt;P&gt;Yeah, Alex, it looks like you need a cast to (LPC_UART_TypeDef) on lines 165 and 166:&lt;/P&gt;&lt;PRE&gt;UART_Init( (LPC_UART_TypeDef *)LPC_UART1,&amp;amp;uartConfig);&lt;BR /&gt;UART_TxCmd( (LPC_UART_TypeDef *)LPC_UART1,ENABLE);&lt;/PRE&gt;&lt;P&gt;For some reason, in whatever version of the tool you're using, uart1 is treated differently than the other uarts. &amp;nbsp;You can see it here, on line 221 of lpc17xx_uart.c that you included:&lt;/P&gt;&lt;PRE&gt; if(((LPC_UART1_TypeDef *)UARTx) == LPC_UART1)&lt;/PRE&gt;&lt;P&gt;All the other instances of uart default to&amp;nbsp;LPC_UART_TypeDef. &amp;nbsp;Make those typecasts, above, and it *should* work. &amp;nbsp;You'll need to typecast&amp;nbsp;LPC_UART1 every time you use it, I'd imagine.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Feb 2022 20:49:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC17xx-UART1/m-p/1410518#M47853</guid>
      <dc:creator>aaronminner</dc:creator>
      <dc:date>2022-02-08T20:49:35Z</dc:date>
    </item>
    <item>
      <title>Re: LPC17xx UART1</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC17xx-UART1/m-p/1410878#M47864</link>
      <description>&lt;P&gt;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/142540"&gt;@aaronminner&lt;/a&gt;&amp;nbsp;Yeah, I did that and it worked. Thank you so much &lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 09:26:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC17xx-UART1/m-p/1410878#M47864</guid>
      <dc:creator>Alex_2221</dc:creator>
      <dc:date>2022-02-09T09:26:13Z</dc:date>
    </item>
  </channel>
</rss>

