This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RM48L952: SCI DMA transfer multi buffer

Part Number: RM48L952


Hello Expert,

I have referred to the app note:  https://www.ti.com/lit/an/spna213/spna213.pdf?ts=1596649942063&ref_url=https%253A%252F%252Fwww.google.com%252F and tried the source code discussed in this application report, but the results for transfer of data in multibuffer is not correct. 

The below are the results after transfer:

Hercule SCI DMA Example - Version 00.00.01.07
*******************************************************************************

scidmaSend Example - DMA to transfer single Bytes from RAM to the SCI
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499

scidmaSend Example Complete, 1890 characters sent
CPU idle count: 2267172

scidmaSend Example - DMA to transfer single Bytes from RAM to SCI
1 0 3 2 5 4 7 6 9 81 0121 1 31 1 4161 5 71 1 8102 9 12 2 2242 3 52 2 6282 7 92 3 0323 1 33 3 4363 5 73 3 8304 9 14 4 2444 3 54 4 6484 7 94 5 0525 1 35 5 4565 5 75 5 8506 9 16 6 2646 3 56 6 6686 7 96 7 0727 1 37 7 4767 5 77 7 8708 9 18 8 2848 3 58 8 6888 7 98 9 0929 1 39 9 4969 5 79 9 8901 901 001 101 201 301 401 501 601 701 811 911 011 111 211 311 411 511 611 711 821 921 021 121 221 321 421 521 621 721 831 931 031 131 231 331 431 531 631 731 841 941 041 141 241 341 441 541 641 741 851 951 051 151 251 351 451 551 651 751 861 961 061 161 261 361 461 561 661 761 871 971 071 171 271 371 471 571 671 771 881 981 081 181 281 381 481 581 681 781 891 991 091 191 291 391 491 591 691 791 802 902 002 102 202 302 402 502 602 702 812 912 012 112 212 312 412 512 612 712 822 922 022 122 222 322 422 522 622 722 832 932 032 132 232 332 432 532 632 732 842 942 042 142 242 342 442 542 642 742 852 952 052 152 252 352 452 552 652 752 862 962 062 162 262 362 462 562 662 762 872 972 072 172 272 372 472 572 672 772 882 982 082 182 282 382 482 582 682 782 892 992 092 192 292 392 492 592 692 792 803 903 003 103 203 303 403 503 603 703 813 913 013 113 213 313 413 513 613 713 823 923 023 123 223 323 423 523 623 723 833 933 033 133 233 333 433 533 633 733 843 943 043 143 243 343 443 543 643 743 853 953 053 153 253 353 453 553 653 753 863 963 063 163 263 363 463 563 663 763 873 973 073 173 273 373 473 573 673 773 883 983 083 183 283 383 483 583 683 783 893 993 093 193 293 393 493 593 693 793 804 904 004 104 204 304 404 504 604 704 814 914 014 114 214 314 414 514 614 714 824 924 024 124 224 324 424 524 624 724 834 934 034 134 234 334 434 534 634 734 844 944 044 144 244 344 444 544 644 744 854 954 054 154 254 354 454 554 654 754 864 964 064 164 264 364 464 564 664 764 874 974 074 174 274 374 474 574 674 774 884 984 084 184 284 384 484 584 684 784 894 994 094 194 294 394 494 594 694 794 8 9

scidmaSend Example Complete, 1890 characters sent
CPU idle count: 4313373


sci transmit time @ 115200bps 81NN
((1890 Bytes) * 10bits per byte ) / 115200: 0.164 

Single buffered data are correct, but in multi buffer the data is corrupted why so? All the configuration is done based on the instruction given in the notes.

Also, I noticed that in scidmaSend() function there is a condition check if (((scilinREG->GCR1 >> 10U) & 1U) == 0U) which is checking whether we have enabled multibuffer or not. What I think is if we enable the multibuffer mode by also by setting the 10 bit of GCR1 register this condition is going to be false as it is checking it to 0 not 1.

Please help me what is wrong with my code I am attaching the project and code here

SCI_0802.zip

  • Hello Rakesh,

    The both set of data you posted are from single-byte transfer. Can you please let me know which one is from the multi-buffer transfer? The 2nd set of data looks the bytes are swapped.

    if (((scilinREG->GCR1 >> 10U) & 1U) == 0U) is to check if the multi-buffered is used or not. It this condition (in if()) is true, the multi-buffered is not used. The data is transferred from RAM to TD register. If this condition is false, the data will be transferred to TDy buffer.

  • Hello QJ,

    Thanks for the reply.

    The second data set is from multibuffer, though it says its a single byte transfer but it was my mistake to give same comment at both place. For the second data set the multibuffer is enabled using the below function:

    /* Enable SCI2 Multi-buffer (4 Byte) transfers */
        linsci2enableMBUFF();

    void linsci2enableMBUFF() {
     /* Enable Multi- Buffer Mode */
     scilinREG->GCR1 |= (uint32)((uint32)1U << 10U);  /* Enable MBUFMODE (SCI2 Only) */

     /* Set transmission length in Bytes */
     scilinREG->FORMAT = (uint32)((uint32)7U << 0U)   /* character length (bits) -1 */
           | (uint32)((uint32)3U << 16U); /* frame length (bytes) -1    */
    }

    I have attached the code in the first comment please refer that code if you have any doubt.

    Also is there any similar example to receive data using DMA?

    Thanks

    Rakesh

  • Hello Rakesh,

    I will do a test on RM48 HDK, then come back to you.

  • Hello Rakesh,

    since the architecture of Buffer registers, the data should be swizzled. The current example code copies buffer[0] to TD3 and buffer[1] to TD2.

    char Buffer[0] should be written to TD0, buffer[1] to TD1,...

  • Hello QJ,

    How can I change to TD0 and TD1 in the code?

    Is it through the line g_dmaCTRLPKT.DADD = (uint32)(&(linREG->TDx)); ? Because am not getting from where I can do that.

    Also will you please share or guide me on how I can receive the data by connecting the TX and RX of the same SCI using DMA. Basically I have to receive the data on SCI using DMA. Please guide me for the same.

    Thanks

  • Hello Rakesh,

    Did you test using the swizzled data? I don't think the DMA setting can swap the buffers. You need to find a way to swizzle the data in memory manually.