Other Parts Discussed in Thread: TL16C752D
Hi, I am currently using this 64 byte FIFO (TL16C752) with C6747 DSP. Currently I am using the FIFO to receive a periodic message of 26 bytes at 50Hz (20ms period). I have set an interrupt from INTA to trigger my read function. Below is the settings for the FIFO uart.
uart settings : 1 start bit, 1 stop bit, 8 data bit, baud 115200, no parity.
input clk is 24MHz (XTAL1)
baud rate = 24MHz (input clk) /1(rescaler) / 13 (DLL) / 16
= 115,385
/********************************************************/
void configureUart(void)
{
SK_TL16C752_LCR |= 0x80; // enable divisor register
SK_TL16C752_DLL = 13; // set divider value to 13
SK_TL16C752_DLH = 0;
Uint8 DLL = SK_TL16C752_DLL; // read back value of divider
Uint8 DLH = SK_TL16C752_DLH;
Uint16 divider = DLL | DLH <<8;
SK_TL16C752_LCR &= 0x7F; // disable divisor register
// Set word length to 8 bits,1 stop,no parity,no break ctrl,disable divisor latch
SK_TL16C752_LCR = 0x3;
SK_TL16C752_FCR |= 0x47; // trigger at 16 chars
// Enable RHR interrupt
SK_TL16C752_IER |= 0x01;
}
/*******************************************************************/
// receive function
void receive()
{
do
{
tLSR = SK_TL16C752_LSR; //get the status of register
LOG_printf(&trace, "tLSR : 0x%x", tLSR);
RECV_BUF[rdata_index] = SK_TL16C752_RHR;
LOG_printf(&trace, "0x%x %x" ,RECV_BUF[rdata_index], tLSR);
rdata_index++;
}while(((tLSR = SK_TL16C752_LSR) & 0x01));
LOG_printf(&trace, " >>>>>>>>>>>>>>>>>>>>>>>>> buf %d ",rdata_index);
}
/******************************************************************************/
results as follows:
1297 0x34 e1
1298 0x12 e1
1299 0xcd e1
1300 0xab e1
1301 0x16 e1
1302 0x0 e1
1303 0x11 e1
1304 0x0 e1
1305 0x1f e1
1306 0x1 e1
1307 0x0 e1
1308 0x0 e1
1309 0x0 e1
1310 0x0 e1
1311 0x80 e1
1312 0x80 e1
1313 0x80 e9
1314 0x80 e9
1315 0x80 e9
1316 0x80 e9
1317 0x80 e9
1318 0x80 e9
1319 0x80 e9
1320 0x80 e9
1321 0x3b e9
1322 0xe4 61
1323 >>>>>>>>>>>>>>>>>>>>>>>>> buf 26
1324 0x34 e1
1325 0x12 e1
1326 0xcd e1
1327 0xab e1
1328 0x16 e1
1329 0x0 e1
1330 0x11 e1
1331 0x0 e1
1332 0x20 e1
1333 0x1 e1
1334 0x0 e1
1335 0x0 e1
1336 0x0 e1
1337 0x0 e1
1338 0x80 e1
1339 0x80 e1
1340 0x80 e9
1341 0x80 e9
1342 0x80 e9
1343 0x80 e9
1344 0x80 e9
1345 0x80 e9
1346 0x80 e9
1347 0x80 e9
1348 0xc7 61
1349 0xfe 61
1350 >>>>>>>>>>>>>>>>>>>>>>>>> buf 26
1351 0x34 e1
1352 0x12 e1
1353 0xcd e1
1354 0xab e1
1355 0x16 e1
1356 0x0 e1
1357 0x11 e1
1358 0x0 e1
1359 0x21 e1
1360 0x1 e1
1361 0x0 e1
1362 0x0 e1
1363 0x0 e1
1364 0x0 e1
1365 0x0 e1
1366 0x80 e1
1367 0x80 e1
1368 0x80 e9
1369 0x80 e9
1370 0x80 e9
1371 0x80 e9
1372 0x80 e9
1373 0x80 e9
1374 0x80 e9
1375 0x3f e9
1376 0xf9 61
1377 >>>>>>>>>>>>>>>>>>>>>>>>> buf 26
1378 0x34 e1
1379 0x12 e1
1380 0xcd e1
1381 0xab e1
1382 0x16 e1
1383 0x0 e1
1384 0x11 e1
1385 0x0 e1
1386 0x22 e1
1387 0x1 e1
1388 0x0 e1
1389 0x0 e1
1390 0x0 e1
1391 0x0 e1
1392 0x0 e1
1393 0x80 e1
1394 0x80 e1
1395 0x80 e9
1396 0x80 e9
1397 0x80 e9
1398 0x80 e9
1399 0x80 e9
1400 0x80 e9
1401 0x80 e9
1402 0xdb e9
1403 0xbe 61
1404 >>>>>>>>>>>>>>>>>>>>>>>>> buf 26
My expected message is 0x34 0x12 0xCD 0xAB 0x16 0x00 0x11 0x00 (2 bytes of counter) (14 bytes of zero) (2bytes of checksum)
strangely I keep getting 0x80 in the middle of the message and my guess is that the 0x80 is the stop bit as there is framing error. Also the checksum at the end is also not correct. Any idea how to resolve this?