Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 5 > Transferring data to Matlab

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



Transferring data to Matlab
Moderator:
ANCY

Post Reply
Follow this topic



Transferring data to Matlab

mike.hersh posted on 04 Oct 2012 2:05 AM PST
Top Contributor
21 Forum Posts

Hi,

I need to transfer a matrix (of numbers) from the PSoC to Matlab using serial port and to be able to save it in a .mat file later.

Also, I need to disply them on real time as a graph, but I can only use 115200 baudrarte.

Someone maybe tried something like this and can help me?

Thanks




Re: Transferring data to Matlab

SpiderKenny posted on 04 Oct 2012 03:17 AM PST
Top Contributor
83 Forum Posts

 In PSoC Creator there is the UART component.

You can use this to transmit data via a serial port. A minimum connection needs only 2 Wires - TX and GND, and if you need data to go back into the PSoC then you'll need RX too. (TX = Transmit, RX = Receive).

In terms of hardware you'd need to add a signal convertor chip such as the MAX232 in order to convert the CMOS level signals from the PSoC to th +/- 12V signals of RS232

Read the data sheet for the UART component in Creator for implementation details.

Post back here with how you get on and if you need any more help or information.



Re: Transferring data to Matlab

mike.hersh posted on 04 Oct 2012 03:45 AM PST
Top Contributor
21 Forum Posts

Hi SpiderKenny,

Thanks but I don't need help regarding the serial interface implementation.

I'm trying to transfer the numbers into Matlab using the serial interface I already using in the PSoC5, 

and the problem is that the Matlab program can't read the data from the serial port, do some math and to display it on a graph in

realtime. I've tried to add a delay for each transfer and it's not working (and I'm really trying to avoid this kind of methods). 

I'm searching for a solution regarding transfering the data fast and safetly (like handshaking) to the Matlab not in the convetional

way of transfering the numbers in characters becuase it just don't work for me.

I thought maybe somehow to encrypt the numbers and to decrypt them back in Matlab. 



Re: Transferring data to Matlab

SpiderKenny posted on 04 Oct 2012 04:09 AM PST
Top Contributor
83 Forum Posts

 Ah right - I see now.

Well, there are various mechanisms for pacing the serial data.

It depends on the size of the receive buffer in matlab, and whether matlab supports handshaking. 

Can I assume you only have  a 3-wire serial interface? So Hardware handshaking is out of the question?

In that case you could use software handshaking, of your design, where matlab sends a 'ready' signal and you transfer a small amount and wait for the next 'ready' - or you could implement your own XON-XOFF handshaking.

Can you describe the problem you are seeing in matlab? Are parts of the data missing? Have you tried asking in any matlab forums?



Re: Transferring data to Matlab

H L posted on 04 Oct 2012 05:51 AM PST
Top Contributor
679 Forum Posts

 How about having psoc sending ascii value with "." or ";" as delimiter. With the matlab prasing the data and store it in an array for display purpose. This way, you can also use a special pattern like AA;55; from the psoc to signal a restart of the readings



Re: Transferring data to Matlab

danaaknight posted on 04 Oct 2012 12:55 PM PST
Top Contributor
1773 Forum Posts

You might start with a basic calculation of how many MIPS you need.

If complex math is being done by Matlab, likle an FFT on the data, Matlab

must have a spec on its algorithim in terms of time to complete, eg input

sample rate.

 

By your description seems like you are trying to effect a DSO, which generally

use hi speed DSP and FPGA to keep up with the data signal processing.

Screen refresh rate one consideration.

 

Regards, Dana.






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: GRAA; Secondary Owner: RAIK; Sunset Date: 01/01/20