1 2 Previous Next 16 Replies Latest reply on Sep 29, 2015 3:26 AM by pavankumar.vibhute

    Matlab to PSOC3






      I wanted to send a matlab data file (.mat) to the psoc flash periodically via USB. 


      So i wanted to ask where to start? How would I convert the .mat file to an acceptable transfer file type? 







        • 1. Re: Matlab to PSOC3

          For the transmission of data you may use the USBUART on the PSoC side and an emulated serial  interface (COMn:) on the PC-side.


          Storing data in flash can be done with the emulated EEProm usermodule (latest Creator update!).


          The question I have is: What do you intend to do with the matlab-file on the PSoC?





          • 2. Re: Matlab to PSOC3

            This just depends on what you want to do with this data file. Since my crystal ball is still in repair and you didn't tell us about your project, I would guess that a CSV file might be the simplest solution.

            • 3. Re: Matlab to PSOC3

              Forgot to mention that Matlab can write CSV directly: www.mathworks.com/help/matlab/ref/csvwrite.html

              • 4. Re: Matlab to PSOC3

                @HLI, what about of creating a CBRC (Crystal Ball Repair Center, I would be in the boat!





                • 5. Re: Matlab to PSOC3

                  Sure, as long as I don't need to promise any success with the repairs :) I will only promise that it will be expensive...

                  • 6. Re: Matlab to PSOC3

                    Many thanks for the reply


                    I actually wanted to transmit a large speech signal from a converted matlab data file (about 3Mb in size) onto the PSOC EEPROM, with the data being overwritten to the EEPROM after it gets full (like a runtime acquisition of data using a FIFO). I'm using the CY8C001 kit.


                    i need to send the matlab file from the PSOC to an FPGA.


                    Will i have to write a seperate program on my PC to send this data?





                    • 7. Re: Matlab to PSOC3
                              Is the streaming in realtime? If yes, there is no need to write to the EEPROM (which not really large). If no - then the memory of the PSoC won't be enough to hold the file.   
                      Depending on the sample rate of the wave file you can get away witrh not needing a special program on the PC side. Using an UART would give you about 10 kbytes/second transfer rate, using an USBUART gives you at most 100kbytes per second.   
                      Both can be used with any program on the PC side being able to write to a serial port. For a wav file, I would suggest really generating one from the MatLab file, and then decode it on the PSoC side. Or maybe you extract the pure waveform stuff, and send just this over, in binary form (to save bandwidth).   
                      Can you explain a little bit more what this project is about?   
                      • 8. Re: Matlab to PSOC3

                        I actually wanted to stream neural signals (stored in my matlab data files) to the PSoC, real time would be better. These signals have been sampled at 20Kb/sec. 


                        I dont have a serial port in my PC, so i wanted to do it using the USB port. 


                        I then have to transmit these stored samples serially from the PSoC to an FPGA, on which the processing will be done. I'm not transmitting the samples directly to the FPGA because the transmission wouldnt remain synchornous.

                        • 9. Re: Matlab to PSOC3

                          A PSoC3 (looking at e.g. CY8C3866AXI-040) as 8kb of RAM, so it will be able to hold about 1/10th of a second worth of data in memory. It has up to 64kb of Flash, this would be up to 3 seconds of data.


                          So we are talking about continous data transfer here. If the PSoC has no other tasks, it would be just work as an USB pridge. In that case, using a specialized one might be better. Lokk at the FT232 chips (and their newer counterparts). Or e.g. the MCP2210 which is a USB-to-SPI bridge (which might make the FPGA part simpler).

                          • 10. Re: Matlab to PSOC3
                                    I would rather recommend using a Cypress EZ-USB FX2LP microcontroller with a dual port RAM chip. the FX2 can easily serve as a hight speed bridge and write data to ram that could be used later by the FPGA.   
                            • 11. Re: Matlab to PSOC3

                              Silly me to forget about the Cypress parts :(

                              • 12. Re: Matlab to PSOC3

                                At 20 Kb/s, read  2.5 KB/s, seems like no shortage of ways to do this.


                                Serial one wire could do this :)    




                                USB > PSOC > One wire/SPI/I2C/RS232/RS485/LVDS...........




                                Regards, Dana.

                                • 13. Re: Matlab to PSOC3

                                   Yes, communication between the PSOC and an FPGA is no problem. 

                                  But i have to do this using the PSOC3 on the CY8C001 kit only. So i only have to write the data to the USB serially, then read it on the PSOC using USBUART functions?


                                  Also, does matlab write directly to a USB port?



                                  • 14. Re: Matlab to PSOC3

                                    Yes to both.




                                    This might help.








                                    Regards, Dana.

                                    1 2 Previous Next