cancel
Showing results for 
Search instead for 
Did you mean: 

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

uzeyir varli
Associate II
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
7 REPLIES 7
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,

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,

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,

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
Posted on February 20, 2018 at 12:11

Could you please give me more information?

for example:

- Simulink file.

- Hardware setup

Thank you.

Posted on February 20, 2018 at 12:14

I use stm32f407VG and usb tll converter

2018-02-20 14:11 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/0D70X000006T00ISAS

________________

Attachments :

uart.mdl.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HxsP&d=%2Fa%2F0X0000000b2g%2FtC2Jqq5rVnpu9Iwa01NIciK1kRPUSUVe1jTMRUqAwQ4&asPdf=false

analog_okuma.mdl.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hxx7&d=%2Fa%2F0X0000000b2d%2FzqCxB5V2fxHCZgB7F7j8cxwDV9blXGMwPgOlfI0PhSU&asPdf=false
Posted on February 20, 2018 at 12:34

Error cause from your Host didn't get data from Target.

Have you check your

usb tll converter connecting pin is correctly?

  • Target: USART3 Tx/Rx Pin D8/D9

  • Host: Which Serial com port you use? Please check for make sure in Device Manager.