<?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>Serialization between STM32 and ISP1705/nRF52</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/66207/serialization-between-stm32-and-isp1705-nrf52</link><description>I am trying to use serialization to connect an STM32F4 to an ISP1705. My goal is too connect to other BLE devices and read some measurements. I have tried a few of the examples (uart over ble etc) and got them working on the ISP itself. I have tried the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 23 Sep 2020 13:06:31 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/66207/serialization-between-stm32-and-isp1705-nrf52" /><item><title>RE: Serialization between STM32 and ISP1705/nRF52</title><link>https://devzone.nordicsemi.com/thread/271104?ContentTypeID=1</link><pubDate>Wed, 23 Sep 2020 13:06:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac05428e-e10f-4a81-a862-1cc0bc843c5d</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Yes. The serialized examples have SVCALL_AS_NORMAL_FUNCTION defined.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This means that when it says e.g.:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;SVCALL(SD_BLE_GAP_ADV_SET_CONFIGURE, uint32_t, sd_ble_gap_adv_set_configure(uint8_t *p_adv_handle, ble_gap_adv_data_t const *p_adv_data, ble_gap_adv_params_t const *p_adv_params));&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;It means:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;
uint32_t sd_ble_gap_adv_set_configure(uint8_t *p_adv_handle, ble_gap_adv_data_t const *p_adv_data, ble_gap_adv_params_t *p_adv_params);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This is the declaration of this function.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Additionally, we have the define in app_mw_ble_gap.c:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#ifndef _sd_ble_gap_adv_set_configure
#define _sd_ble_gap_adv_set_configure sd_ble_gap_adv_set_configure
#endif
uint32_t _sd_ble_gap_adv_set_configure(uint8_t *p_adv_handle,
                                       ble_gap_adv_data_t const *p_adv_data,
                                       ble_gap_adv_params_t const *p_adv_params)
{
    ...&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;It is a bit confusing, but try to follow this:&lt;/p&gt;
&lt;p&gt;if _sd_ble_gap_adv_set_configure is not defined (which it is not), then define it to mean sd_ble_gap_adv_set_configure. Done.&lt;/p&gt;
&lt;p&gt;Then it says:&lt;/p&gt;
&lt;p&gt;uint32_t _sd_ble_gap_adv_set_configure(...), but this is a macro that we just defined, so what it really says is:&lt;/p&gt;
&lt;p&gt;uint32_t sd_ble_gap_adv_set_configure(...).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So this is the definition of the softdevice call sd_ble_gap_adv_set_configure() when SVCALL_AS_NORMAL_FUNCTION is defined.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If SVCALL_AS_NORMAL_FUNCTION is not defined, then you would have a double definition of the softdevice call, sd_ble_gap_adv_set_configure(), but the non-serialized examples doesn&amp;#39;t contain the app_mw_ble_gap.c file, so that is why it works in the non-serialized examples.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Does that clarify things a bit?&lt;/p&gt;
&lt;p&gt;If you have the defines correct, then you should be able to call sd_ble_gap_adv_set_configure() from main, and then set a breakpoint inside _sd_ble_gap_adv_set_configure(), and it should be hit (try to turn off optimization on the STM if you want to test this). Obviously, in order to compile, then ble_gap_adv_set_configure_rec_enc() needs to be defined, which leads to a tunnel of new requirements, but they should all lead out in&amp;nbsp;not too many files, requiring you to implement the serialization layer that you are using, such as for example UART.&amp;nbsp;&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: Serialization between STM32 and ISP1705/nRF52</title><link>https://devzone.nordicsemi.com/thread/271003?ContentTypeID=1</link><pubDate>Wed, 23 Sep 2020 08:29:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:914f10f8-470a-4df7-b197-2ae4dfa869f2</guid><dc:creator>sveenman</dc:creator><description>&lt;p&gt;as an edit to my previous response, i started slowly pulling out parts of the serializing code to try to get something to work on the STM. during that i found that in the softdevice headers for &amp;quot;nrf_svc&amp;quot; there is a difference between serialized examples and non serialized ones.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;
#ifdef SVCALL_AS_NORMAL_FUNCTION
#define SVCALL(number, return_type, signature) return_type signature
#else

#ifndef SVCALL
#if defined (__CC_ARM)
#define SVCALL(number, return_type, signature) return_type __svc(number) signature
#elif defined (__GNUC__)
#ifdef __cplusplus
#define GCC_CAST_CPP (uint16_t)
#else
#define GCC_CAST_CPP
#endif
#define SVCALL(number, return_type, signature)          \
  _Pragma(&amp;quot;GCC diagnostic push&amp;quot;)                        \
  _Pragma(&amp;quot;GCC diagnostic ignored \&amp;quot;-Wreturn-type\&amp;quot;&amp;quot;)   \
  __attribute__((naked))                                \
  __attribute__((unused))                               \
  static return_type signature                          \
  {                                                     \
    __asm(                                              \
        &amp;quot;svc %0\n&amp;quot;                                      \
        &amp;quot;bx r14&amp;quot; : : &amp;quot;I&amp;quot; (GCC_CAST_CPP number) : &amp;quot;r0&amp;quot;   \
    );                                                  \
  }                                                     \
  _Pragma(&amp;quot;GCC diagnostic pop&amp;quot;)

#elif defined (__ICCARM__)
#define PRAGMA(x) _Pragma(#x)
#define SVCALL(number, return_type, signature)          \
PRAGMA(swi_number = (number))                           \
 __swi return_type signature;
#else
#define SVCALL(number, return_type, signature) return_type signature
#endif
#endif  // SVCALL

#endif  // SVCALL_AS_NORMAL_FUNCTION&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;in the serialized one the &amp;#39;SVCALL_AS_NORMAL_FUNCTION&amp;#39; is defined. I beleive this is what causes&amp;nbsp;&lt;span&gt;_sd_ble_gap_adv_set_configure in app_mw_ble_gap.c to be used instead of a direct softdevice call? this is the kind of stuff i would like help with. By just copying the code and trying to compile it i will never figure out what all these devines mean and what needs to be defined.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Is there some sort of guide in getting the serialization code to compile or work on something else then a nRF52?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Serialization between STM32 and ISP1705/nRF52</title><link>https://devzone.nordicsemi.com/thread/270982?ContentTypeID=1</link><pubDate>Wed, 23 Sep 2020 07:28:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6231d67f-af6d-4e74-b571-665fccce6923</guid><dc:creator>sveenman</dc:creator><description>&lt;p&gt;After getting it to work the way i did before again it goes into the SVCALL line, and then into a&amp;nbsp;SVC_Handler but that doesn&amp;#39;t do anything. then moved on to the next line.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I understand how the serialization library works, i am just not getting it to compile and include correctly so that it uses UART to send it. We don&amp;#39;t have two DK&amp;#39;s for the serialized example, but i beleive that that example would work fine.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I would have liked to be able to include most needed files, compile them and try to port them to the STM32 so that it would work. It doesn&amp;#39;t seem to be doable right now though. So i guess i will have to use the serializers and middleware code to try to rewrite most of it into my own library so that everything works correctly. I would have hoped to safe time in this part by including all files at once and only porting one part.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Serialization between STM32 and ISP1705/nRF52</title><link>https://devzone.nordicsemi.com/thread/270901?ContentTypeID=1</link><pubDate>Tue, 22 Sep 2020 14:47:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e38b2aad-331f-4ba6-9927-f16d8113b002</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;The way that the serialization library works is that all the softdevice calls, that would normally be handled by the softdevice precompiled .hex file, and return a value, will now be translated into a UART command, and passed over UART to the nRF, which will execute that softdevice call, receive a return value, and then report that value back over serial (UART in this case).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t looked into the implementation, like the part that you link to here. But perhaps it is waiting for the return value via serial. I think you should look into porting the serial part of the project, since this will indicate whether or not it is working.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Try to run the serialized application examples in the SDK, such as the SDK\examples\ble_peripheral\ble_app_hrs\pca10040\ser_s132_uart project, and look at how the softdevice calls are propagated. If you have two DKs, you can try to run them serialized using &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/nrf51_setups_serialization.html" rel="noopener noreferrer" target="_blank"&gt;this guide&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;As you can see from these examples, unlike in the normal examples, you have some source code for the softdevice calls, e.g. _sd_ble_gap_adv_set_configure in app_mw_ble_gap.c, which calls&amp;nbsp;ser_sd_transport_cmd_write().&lt;/p&gt;
&lt;p&gt;Are these reached in your STM project?&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><item><title>RE: Serialization between STM32 and ISP1705/nRF52</title><link>https://devzone.nordicsemi.com/thread/270879?ContentTypeID=1</link><pubDate>Tue, 22 Sep 2020 13:54:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00ddbd9a-f3b6-4ada-bd14-ade5768ab1d3</guid><dc:creator>sveenman</dc:creator><description>&lt;p&gt;I have seen the article you mentioned. When looking at the article it mentions some files that have to be ported, but not any starting point in porting the application.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The SVCALL led to (if i remember correctly) the define, and stopped in the asm lines if i remember correctly.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define SVCALL(number, return_type, signature)          \
  _Pragma(&amp;quot;GCC diagnostic push&amp;quot;)                        \
  _Pragma(&amp;quot;GCC diagnostic ignored \&amp;quot;-Wreturn-type\&amp;quot;&amp;quot;)   \
  __attribute__((naked))                                \
  __attribute__((unused))                               \
  static return_type signature                          \
  {                                                     \
    __asm(                                              \
        &amp;quot;svc %0\n&amp;quot;                                      \
        &amp;quot;bx r14&amp;quot; : : &amp;quot;I&amp;quot; (GCC_CAST_CPP number) : &amp;quot;r0&amp;quot;   \
    );                                                  \
  }                                                     \
  _Pragma(&amp;quot;GCC diagnostic pop&amp;quot;)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t actually started porting any of the UART drivers or files mentioned in the &amp;quot;&lt;span&gt;Porting serialization libraries&lt;/span&gt;&amp;quot; because i am prity sure the way my files are compiling / included isn&amp;#39;t correct. I havent actually had to change any of the uart code which is most likely because they arent being used. I cant check what i had before anymore since i removed that code and tried something else with little success.&lt;/p&gt;
&lt;p&gt;Currently i am stuck at starting the port, i dont know which files i have to include, how i should go about compiling and including them correctly and then where to start porting the driver code. If i am honest i find this part lacking, or i havent found it yet in the documentation. The documentation mentions which files need to be ported and whast the functions in those files have to do, but not how to start with compiling and what the total serialization package is. My STM32 project is in Attolic TRUESTUDIO, so i cant copy any of the example projects to get the serialization compiling correctly. I have to set ble / serialization part of the project up again in a different environment, this part i can&amp;#39;t find anywhere on the documentation and i would love some pointers for this.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Serialization between STM32 and ISP1705/nRF52</title><link>https://devzone.nordicsemi.com/thread/270874?ContentTypeID=1</link><pubDate>Tue, 22 Sep 2020 13:39:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a3f7235-2c24-48ba-af44-2ea6e471575b</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Have you seen &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/serialization_porting_guide.html"&gt;this article&lt;/a&gt;?&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t think we have any finished serialization projects for STM32, as far as I know, unfortunately.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;[quote user=""][/quote]&lt;/p&gt;
&lt;p&gt;SVCALL(SD_BLE_GAP_APPEARANCE_SET, uint32_t, sd_ble_gap_appearance_set(uint16_t appearance))&amp;#39; line in ble_gap.h and doesn&amp;#39;t reach the function implementation in the middleware.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;What happens during this call? Do you see any data on the UART lines from the STM? (Try to analyze them with a logic analyzer)&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></channel></rss>