<?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>Hardfault at CDC</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/62291/hardfault-at-cdc</link><description>My PC is windows 7 64-bit. I use SDK16 with softdevice. I am porting CDC code to my application as follows. It has 2 issues. 1st: It will cause hardfault if I call the function of displayMainScreen in main function. (Just power on step). It will work</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 09 Jun 2020 14:38:57 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/62291/hardfault-at-cdc" /><item><title>RE: Hardfault at CDC</title><link>https://devzone.nordicsemi.com/thread/254075?ContentTypeID=1</link><pubDate>Tue, 09 Jun 2020 14:38:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:efb7511a-ba6b-4db0-a58a-7a338456cb47</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Yes. That sounds like a possible issue. If you write too long byte arrays into smaller sized buffers, then you will continue to write after the buffer address, changing whatever is behind that in flash. It can typically lead to hard faults. Try increasing the size of the buffer, or lowering the size of the string that you write.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hardfault at CDC</title><link>https://devzone.nordicsemi.com/thread/253968?ContentTypeID=1</link><pubDate>Tue, 09 Jun 2020 09:04:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:196e9f1f-8e08-4aa3-8659-7795a02d7412</guid><dc:creator>Ted</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/edvin-holmseth"&gt;Edvin&lt;/a&gt;&amp;nbsp;Sorry to bother you. It seems the code cause the hardfault as follows. The code prints too long, it prints about 77 characters. But the&amp;nbsp;&lt;span&gt;m_tx_buffer has only 64 bytes. I need to do more test. Thank you very much.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;sprintf((char*)m_tx_buffer, &amp;quot;Options: %3dMHz, Try %2d, flash size: 0x%4x, erase: 0xD400, LFID: 0x%4x\r\n&amp;quot;&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;strong&gt;,CARRIER_FREQ, TRY_TIMES, DEST_CODE_SIZE-4, LF_WAKEUP_ID_APP);&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;strong&gt;SEND_UART_STRING(m_tx_buffer);&amp;nbsp;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Hardfault at CDC</title><link>https://devzone.nordicsemi.com/thread/253832?ContentTypeID=1</link><pubDate>Mon, 08 Jun 2020 14:00:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d3d6321-f9d2-45c2-adb2-c07f1188e818</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;You say that you run into a hardfault? I suspect that you mean an app_error? What does it look like? Does the log say anything?&lt;/p&gt;
&lt;p&gt;2: When the application isn&amp;#39;t running, then the USB is not enumerated, so the computer will not detect it as a USB device before it is running. Usually, USB devices will get power from the USB port, so it will start the application once you plug it in.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>