<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Adding UART code to the &amp;#39;light switch server&amp;#39; project</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/59428/adding-uart-code-to-the-light-switch-server-project</link><description>Hi, 
 I am evaluating the nRF52840-DK and wanted to add some debug code to the UART. 
 
 I have used the same libraries as the &amp;#39;UART_PCA10056 (which works), but when the code is linked an error comes as follows:- 
 
 
 Please advise where to look at for</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 25 Mar 2020 22:25:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/59428/adding-uart-code-to-the-light-switch-server-project" /><item><title>RE: Adding UART code to the 'light switch server' project</title><link>https://devzone.nordicsemi.com/thread/241688?ContentTypeID=1</link><pubDate>Wed, 25 Mar 2020 22:25:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ad5dc7e1-fc0f-4c44-83fd-0e9aeb246531</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Paul,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It turned out that the serial library in the mesh SDK is not capable of printing out a string so there is a buffer needed (this is implemented inside the serial.c library which related to mesh serialization, which we don&amp;#39;t plan to use here).&amp;nbsp;&lt;br /&gt;So we need to use the app_uart library in nRF5 SDK instead (this is the library that the log in nRF5 SDK uses).&lt;/p&gt;
&lt;p&gt;I attached here the example I made for SDK v4.0 . Basically you need to add app_fifo, app_uart_fifo and retarget.c&amp;nbsp;&lt;br /&gt;log.c is modified to log_serial.c to print out to serial instead of RTT.&amp;nbsp;&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-924f9f66971344fdbb61395bb0a366a5/light_5F00_switch-_2D00_-SerialLog.zip"&gt;devzone.nordicsemi.com/.../light_5F00_switch-_2D00_-SerialLog.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding UART code to the 'light switch server' project</title><link>https://devzone.nordicsemi.com/thread/241629?ContentTypeID=1</link><pubDate>Wed, 25 Mar 2020 14:53:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:df7dd221-7e00-41b3-bb2f-0edf56a6d482</guid><dc:creator>Paul Mercer</dc:creator><description>&lt;p&gt;Can you please give an example of this, even if it is text and not an actual example.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding UART code to the 'light switch server' project</title><link>https://devzone.nordicsemi.com/thread/241623?ContentTypeID=1</link><pubDate>Wed, 25 Mar 2020 14:28:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac352ad5-0ef9-45e9-9ec5-8e79b7d538ba</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;You would need to modify the log.c to add log callback for uart instead of rtt. Then modify main.c to call&amp;nbsp;__LOG_INIT with the callback to uart.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding UART code to the 'light switch server' project</title><link>https://devzone.nordicsemi.com/thread/241572?ContentTypeID=1</link><pubDate>Wed, 25 Mar 2020 11:03:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40cbf5da-8d47-47f7-93c1-e30d33d9b5b8</guid><dc:creator>Paul Mercer</dc:creator><description>&lt;p&gt;Thanks that has sorted that out.&lt;/p&gt;
&lt;p&gt;One more question though. I am getting the serial information in the debug window, but want it to come out on the virtual serial port the same as project &amp;#39;uart_pca10056&amp;#39;. What do I change to make this happen?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding UART code to the 'light switch server' project</title><link>https://devzone.nordicsemi.com/thread/241439?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 16:51:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ceebed90-fc51-4d00-8857-cae0c79f7bb5</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;You can find the usage of the serial_uart.c library in the serial example in mesh SDK. However the use of this module in the example is not for logging but for serialization of mesh stack.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;There must be a define of&amp;nbsp;&lt;span&gt;UARTE0_UART0_IRQHandler inside&amp;nbsp;nrfx_irqs_nrf52832.h if the file was included.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding UART code to the 'light switch server' project</title><link>https://devzone.nordicsemi.com/thread/241410?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 14:45:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:349deaf3-1283-461d-9e0c-2573c637cbfa</guid><dc:creator>Paul Mercer</dc:creator><description>&lt;p&gt;Do you have any example code of using the serial_uart.c and functions?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding UART code to the 'light switch server' project</title><link>https://devzone.nordicsemi.com/thread/241396?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 13:52:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60792dd9-bb26-4f08-8ca5-a14ae8c55670</guid><dc:creator>Paul Mercer</dc:creator><description>&lt;p&gt;I have done a search and there are 3 instances in the project and all in the same file. I have done a search for other IRQ&amp;#39;s and they come back with 3 hits as well.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1585057857914v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1585057903272v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1585057930400v3.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding UART code to the 'light switch server' project</title><link>https://devzone.nordicsemi.com/thread/241388?ContentTypeID=1</link><pubDate>Tue, 24 Mar 2020 13:24:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1f7c3e06-baa3-4c7d-8030-e30c98dce565</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Paul,&amp;nbsp;&lt;br /&gt;It&amp;#39;s complaining that the UART0 interrupt handler was defined twice.&amp;nbsp;&lt;br /&gt;Could you do a full search (Ctrl+Shift+F) and look for &amp;quot;UARTE0_UART0_IRQHandler&amp;quot; ?&lt;br /&gt;Note that in nrf51_to_nrf52.h file we have a define&amp;nbsp;&amp;nbsp; &amp;nbsp; #define UART0_IRQHandler&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; UARTE0_UART0_IRQHandler&amp;nbsp;&lt;br /&gt;So if there is a define of&amp;nbsp;UART0_IRQHandler function somewhere else then we will also have a multiple definition.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Note that in mesh SDK we also have a serial library called serial_uart.c that you may use.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>