- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've been trying to control my PSoC code from Matlab via USBUART and have had difficulty sending data from Matlab to the chip.
I have tried impementing both the SPIM_SAR_USB example project and CE60246 (modified for an updated USB interface). Implementing CE60246, I have tried sending data using the fwrite and binblockwrite (I don't think this second one should work). In both cases, Matlab does not complete the transmission and freezes.
Sending data from the PSoC to Matlab has worked fine, so long as the ..PutData() script is inserted in a forever loop. Sending a receipt acknowledgement from Matlab that would terminate the for loop and allow the program to continue is exactly what I want to do next. Has anybody had similar issues, and if so, is there a solution?
Thanks for reading
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I haven't MATLAB and CE60246, however
I was considering something in program of PSoC.
[1] You can see received data by using JTAG or SWD debugger.
What was received data?
... /* Wait for input data from PC */
... while(USBUART_1_DataIsReady() == 0u);
... USBUART_1_GetAll(rdBuffer);
... <--- CHECK DATA HERE
[2] I think, this code is suspicious
... sprintf((char *)wrBuffer, "The ADC_0 channel(%d) is: 0x%4x \n\r\n\r", <--- this ONE
... (int)rdValue, adcReading);
...
... PrintToUSBUART((char8 *)wrBuffer);
On the Matlab side, will receive two lines.
If so, Is Matlib work correctly?
This might be out of point, I'm not sure.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What program cable did you use?
Anyway, you need to isolate the problem.
if had no debugger, you can check it LED debug.
Put TestPin_write(0) and TestPin_write(1)
before test point and after test point.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you do not have a PSOC board for debugging, you can always create a simple
UART link to PC and pass debug info over that, like variable values, port and pin states,
etc. You can get a UART example project by right clicking unselected UART component,
and picking "Find example project". You can add that to you workspace of open in a new
workspace and cut and paste to your target workspace.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
can anyone help me whether matlab will generate a c code automatically for psoc controller?