I'm trying to test a communication between my LPC4370 cortex-m4 micro (LPC Link2 eval board) and my computer, using the VCOM exaple provided with LPCOpen. I simply want to sent data from matlab, copy them in a int32_t array and send them back to host.
Here's what I tried. From Matlab:
fwrite(serial_object,raw_data,'int32');
For the C part, I summarize with only relevant code:
#define RAW_SIZE 1024
unsigned char uint8_t;
typedef int int32_t;
// My Buffer
__DATA(RAM) int32_t buffer_rt_s[RAW_SIZE] = {0};
// VCOM-UART rx buffer
static uint8_t g_rxBuff[4*RAW_SIZE];
int i;
int main()
{
vcom_bread((uint8_t*)&g_rxBuff[0], 4*RAW_SIZE);
for(i=0; i < RAW_SIZE; i=i+1)
{
buffer_rt_s[i]=(int32_t*)(&g_rxBuff[0]+i*4);
}
vcom_write((uint8_t*)&buffer_rt_s[0], 4*RAW_SIZE);
}
What I'm trying to do here
for(i=0; i < RAW_SIZE; i=i+1)
{
buffer_rt_s[i]=(int32_t*)(&g_rxBuff[0]+i*4);
}
is to access the receving buffer advancing by 4 bytes at each iteration. So I ask for the address
(&g_rxBuff[0]+i*4)
And then for the content at that location, specifying I want a 32 bit number (i.e. 4 bytes):
(int32_t*)
Results form Matlab plot. To me it seems a lot like I'm reading the addresses of the receiving buffer instead of the content. Notice that I already used the vcom functions with matlab, and I know for sure that they are working.
Any help would be appreciated. Andrea