Skip to main content
uzeyir varli
Associate
February 11, 2018
Question

How can I read analog to send computer on serialPort by using uart?

  • February 11, 2018
  • 2 replies
  • 1762 views
Posted on February 11, 2018 at 15:40

Hello I am Üzeyir. I use stm32f4 discovery.  I should read analog value on simulink.  I made a basic application. My application is that i use potansiyometre because of channing of analog value. If ADC is upper 500 , PD12 and PD13 will activated. otherwise PD15 and PD15 digital outputs will be activated. Digital outputs ara activated according to analog value.  But ı cannot not drawed on simulink or read. . I tried a lot ways.

But ı taken a errors which is''Error reported by S-function 'amg_usbconverter_n_connect' in 'analog_okuma/Host Serial Rx':

Error: timeout occur while waiting for Rx data.'' 

How can i read analog value? 

https://community.st.com/tags/♯/?tags=readanalogvalue

0690X00000609g5QAA.png0690X00000609XTQAY.png

null
    This topic has been closed for replies.

    2 replies

    Visitor II
    February 15, 2018
    Posted on February 15, 2018 at 04:06

    Hello,

    Üzeyir

    .

    Could you please give me more information?

    for example:

    - Simulink file.

    - Hardware setup

    For more information about UART you can see tutorial from these links:

    http://aimagin.com/blog/how-to-use-uart-communication-port/

     

    http://aimagin.com/blog/using-hardware-in-the-loop-with-waijung/

     

    In addition, you can ask Aimagin's support team any questions about Waijung Blockset at 

    https://support.aimagin.com/

    .

    Best regards,

    Visitor II
    February 20, 2018
    Posted on February 20, 2018 at 04:07

     Hi, 

    Üzeyir

    .

    Firstly, you need to separate as Target and Host. Target is MCU and Host is Simulink monitoring.

    In the Target you must to use UART block in On-chip Peripherals and if you want to send data to MCU p

    lease change UART Rx to Non-blocking transfer mode because in blocking mode your MCU doesn't do not thing while waiting for Rx data. 

    In the Host(PC) use Host Serial for receiving data from MCU.

     0690X00000609WdQAI.png

    Best regards,

    Visitor II
    February 20, 2018
    Posted on February 20, 2018 at 08:35

    You can use

    http://www.st.com/en/development-tools/stm32-mat-target.html

    in External mode as show in picture below.

    0690X00000609iMQAQ.png

    However,

    stm32f4 discovery

    require VCP(Virtual Com Port) for External mode (

    http://www.st.com/en/development-tools/stm32-mat-target.html

    ) andcommunicate with

    http://waijung.aimagin.com/

    .

    So, you need to setup your hardware like picture below. For detail you can see in this

    https://community.st.com/0D50X00009XkX71SAF

    .

    0690X00000609kWQAQ.png

    source:

    http://aimagin.com/blog/using-hardware-in-the-loop-with-waijung/

    Best regards,

    uzeyir varli
    Associate
    February 20, 2018
    Posted on February 20, 2018 at 10:38

    I have this error. How can i solve this error?

    Best Regards

    2018-02-20 10:36 GMT+03:00 Aimagin Co., Ltd. <st-microelectronics@jiveon.com

    >:

    STMicroelectronics Community

    <https://community.st.com/?et=watches.email.thread>

    Re: How can I read analog to send computer on serialPort by using uart?

    reply from Aimagin Co., Ltd.

    <

    and Audio* - View the full discussion

    <https://community.st.com/0D70X000006Sw9jSAC

    ________________

    Attachments :

    timeout occured while waiting for Rx data.PNG : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HxxX&d=%2Fa%2F0X0000000b2o%2F6nnS_QvJ0CRahIoXpu5RxDoAba8X2UXZeXYmXW8.FI8&asPdf=false