Not applicable
Mar 19, 2015
05:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar 19, 2015
05:31 AM
Hello,
I have the following Problem when i try to send data through SSC (SPI).
Dave generates me the Send Function:
void U0C0_SSC_vSendData(uword uwData)
{
while(!(U0C0_PSR & 0x2000)); // wait until tx buffer indication flag is set
U0C0_PSCR |= 0x2000; // clear transmit buffer indication flag
U0C0_TBUF00 = uwData; // load transmit buffer register
} // End of function U0C0_SSC_vSendData
But when I call this function it always gets stuck in the while loop.
When i comment out this line it will only send a short 0.
Can anyone help me with this problem?
I have the following Problem when i try to send data through SSC (SPI).
Dave generates me the Send Function:
void U0C0_SSC_vSendData(uword uwData)
{
while(!(U0C0_PSR & 0x2000)); // wait until tx buffer indication flag is set
U0C0_PSCR |= 0x2000; // clear transmit buffer indication flag
U0C0_TBUF00 = uwData; // load transmit buffer register
} // End of function U0C0_SSC_vSendData
But when I call this function it always gets stuck in the while loop.
When i comment out this line it will only send a short 0.
Can anyone help me with this problem?
7 Replies
Not applicable
Mar 19, 2015
10:30 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar 19, 2015
10:30 PM
Is the first data you tried to send already stuck in the while loop?
If the flag is not set, it indicated the TBUF is not ready for transmission.
If the flag is not set, it indicated the TBUF is not ready for transmission.
Not applicable
Mar 22, 2015
04:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar 22, 2015
04:47 AM
Thank you for the answer. I found out that the function gets stuck at the second call. The first one is no problem.
In addition, if i add a time delay it works fine. I cannot work with a time delay because i need all the data in one SSC Frame in order that the slave understands the message.
I tried to work with the dave fifo function (U0C0_SSC_vFillTxFIFO). So when i use the fifo function i have all data in one frame. So i will take this as a solution.
I send 2 Bytes with commands and then i expect 18 Bytes answer by the slave. Is there any application node how to receive and store a message like that?
In addition, if i add a time delay it works fine. I cannot work with a time delay because i need all the data in one SSC Frame in order that the slave understands the message.
I tried to work with the dave fifo function (U0C0_SSC_vFillTxFIFO). So when i use the fifo function i have all data in one frame. So i will take this as a solution.
I send 2 Bytes with commands and then i expect 18 Bytes answer by the slave. Is there any application node how to receive and store a message like that?
Not applicable
Mar 23, 2015
07:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar 23, 2015
07:54 AM
I tried to generate the RX FIFO with Dave 2, which gives me the macro: U0C0_SSC_uwGetRxFIFOData()
When I call this from my user function the linker will give me this error:
c166 E208: ["..\LTC6803.c" 129/18] syntax error - token ")" inserted before "far"
c166 E208: ["..\LTC6803.c" 129/18] syntax error - token "" inserted before ")"
c166 E208: ["..\LTC6803.c" 129/18] syntax error - token ")" inserted before "0x204120"
c166 E208: ["..\LTC6803.c" 129/18] syntax error - token ";" inserted before "0x204120"
c166 E207: ["..\LTC6803.c" 129/18] syntax error - token ")" deleted
c166 E207: ["..\LTC6803.c" 129/18] syntax error - token ")" deleted
Is there any tutorial or Application note with example code how to send/receive Data over SPI for the XC2000 Family?
When I call this from my user function the linker will give me this error:
c166 E208: ["..\LTC6803.c" 129/18] syntax error - token ")" inserted before "far"
c166 E208: ["..\LTC6803.c" 129/18] syntax error - token "
c166 E208: ["..\LTC6803.c" 129/18] syntax error - token ")" inserted before "0x204120"
c166 E208: ["..\LTC6803.c" 129/18] syntax error - token ";" inserted before "0x204120"
c166 E207: ["..\LTC6803.c" 129/18] syntax error - token ")" deleted
c166 E207: ["..\LTC6803.c" 129/18] syntax error - token ")" deleted
Is there any tutorial or Application note with example code how to send/receive Data over SPI for the XC2000 Family?
Not applicable
Mar 25, 2015
01:59 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar 25, 2015
01:59 AM
Hi Joe,
Not sure if you already know, as SSC master, if you need to received 18bytes data, you need to sent 18bytes of dummy data too.
This is to generate the clock for the slave to transmit the data out.
I'm not too sure why you get the error with U0C0_SSC_uwGetRxFIFOData().
Can you post a code snippet on how you call it?
Not sure if you already know, as SSC master, if you need to received 18bytes data, you need to sent 18bytes of dummy data too.
This is to generate the clock for the slave to transmit the data out.
I'm not too sure why you get the error with U0C0_SSC_uwGetRxFIFOData().
Can you post a code snippet on how you call it?
Not applicable
Mar 25, 2015
02:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar 25, 2015
02:29 AM
Hi Jackson,
I want to send 2 Data Bytes with commands and then i expect an answer of 6 to 18 (depends on the command) from the slave. So what i did is that i have an tx array with 8 Bytes and a rx array of 6 Bytes (for the 6 Byte Command).
Here is the routine:
uword tx_data[8] = {0x00};
uword rx_data[6] = {0x00};
tx_data[0] = LTC_RDCFG;
tx_data[1] = ubSetPECbyte(LTC_RDCFG);
U0C0_SSC_vFillTxFIFO(tx_data, 8);
for (ubyte cnt = 0; cnt < 6; cnt++)
{
rx_data[cnt] = U0C0_SSC_uwGetRxFIFOData();
}
I included the header of "USIC0.h" and "U0C0.h". The call of U0C0_SSC_uwGetData() works fine.
Also there is a different case where we send 2 Bytes and then the slave needs the clock signal and cs for about 12ms (measure time). Is there a possibility to provide the clock and cs "by hand" for a certain time without sending dummy bytes?
Thank you for your help.
Joe
I want to send 2 Data Bytes with commands and then i expect an answer of 6 to 18 (depends on the command) from the slave. So what i did is that i have an tx array with 8 Bytes and a rx array of 6 Bytes (for the 6 Byte Command).
Here is the routine:
uword tx_data[8] = {0x00};
uword rx_data[6] = {0x00};
tx_data[0] = LTC_RDCFG;
tx_data[1] = ubSetPECbyte(LTC_RDCFG);
U0C0_SSC_vFillTxFIFO(tx_data, 8);
for (ubyte cnt = 0; cnt < 6; cnt++)
{
rx_data[cnt] = U0C0_SSC_uwGetRxFIFOData();
}
I included the header of "USIC0.h" and "U0C0.h". The call of U0C0_SSC_uwGetData() works fine.
Also there is a different case where we send 2 Bytes and then the slave needs the clock signal and cs for about 12ms (measure time). Is there a possibility to provide the clock and cs "by hand" for a certain time without sending dummy bytes?
Thank you for your help.
Joe
Not applicable
Mar 27, 2015
02:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar 27, 2015
02:03 AM
Hi Joe,
No, it is not possible to generate the code without sending dummy bytes.
So you have to either send 0x00 or 0xFF depends on your idle state value.
No, it is not possible to generate the code without sending dummy bytes.
So you have to either send 0x00 or 0xFF depends on your idle state value.
Not applicable
Mar 30, 2015
12:28 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mar 30, 2015
12:28 PM
Hey Jackso,
ok, thank you for your answers.
cheers, Joe
ok, thank you for your answers.
cheers, Joe