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.

[FAQ] MSPM33C321A-Q1: MSPM33/M0 Manchester Code Solution

Part Number: MSPM33C321A-Q1
Other Parts Discussed in Thread: LP-MSPM0G3519, MSPM33C321A



1. Background

In automotive and industrial application, Manchester code is commonly used. Sometimes devices requires multiple Manchester coding channels.
This FAQ page would be helpful to implement such usage of Manchester code on MSPM33 and MSPM0.

There are two ways to test Manchester code solution on MSPM33/M0.

Features example support channel #
UART extend HW can automatically convert and transmit Manchester coded data on UART frame.
Each frame has start-bit and stop-bit.
included in SDK TX: 1ch
RX: 1ch
UART-DALI Manchester HW can automatically convert and transmit Manchester coded data on UART-DALI frame. TX: 1ch
RX: 1ch
SPI & timer capture it's based on SPI so that the maximum baudrate is so high.
On the other hand, the decoding process has bottleneck on its SRAM bandwidth.

Coming soon

For M33C321
TX: download here
RX: download here 

For M0G3519
TX: download here
RX: download here

TX: up to SPI ch#
RX: up to 4ch

In the following sections, I mainly assumed "SPI & Timer capture" usage on MSPM33.


2. Requirements

  • LP-MSPM33C321
  • (option) LP-MSPM0G3519
  • CCS 20.5+
  • MSPM33 SDK 1.03.00.01
  • (option) MSPM0 SDK 2.09.00.01


3. Quick Start Guide

3.1 UART extend

Users can run the example project in the SDK. Regarding the setup, you can find in the Readme.

  • <M33SDK DIR>\examples\nortos\LP_MSPM33C321A\driverlib\uart_extend_manchester_echo
  • <M33SDK DIR>\examples\nortos\LP_MSPM33C321A\driverlib\uart_extend_manchester_send_packet

3.2 SPI & timer capture

User can download the example projects on the links in the above table.

Firstly, Build and Flash the TX and RX project into each boards.

  • TX side: Demo_manchester_encoding_tx_LP_MSPM33C321A_xxx
  • RX side: Demo_manchester_decoding_rx_LP_MSPM33C321A_xxx

Next connect two boards like below diagrams.

Table 3-1. MSPM33 Manchester Encoding TX Example Pin Usage

 
Table 3-2. MSPM33 Manchester Decoding RX Example Pin Usage

Then, you can get the decoded data on RX side debug window.


4. FAQ

4.1      How to Modify the Message Size for TX and RX

For TX side, users can set desired the message size by updating MAX_FRAME_SIZE in main.c.
Similarly, for RX side, users just need to change MAX_FRAME_SIZE to match the TX side value.

However, it absolutely must be satisfied with DMA arrays space. They are placed at fixed address every 0x800, so the message size should be lower than 32Bytes with the default mapping.

 

4.2      How to Configure the Manchester TX/RX channel to custom pin

For TX channel, this example uses SPI as the actual interface as denoted in Section 2.1. Users can assign Manchester TX pins to any PICO pins.
For RX channel, timer capture works for decoding as denoted in Section 2.2. Users can choose any pins supporting the capture function.

 

4.3      How to Allocate the Address for DMA-access Array

In the RX example project, it allocates the separated region on SRAM for DMA-access arrays of each RX channel. The DMA0 related arrays, dmaArray and dmaArray1, are allocated in bank 1; the DMA1 related arrays, dmaArray2 and 3, are in bank 2 & 3. That helps to mitigate the bank conflict.

 

Here's the performance test result:
Received and decoded the packet-frame every 500ms, and Got the error-rate in the long-time measurement. You can try the debug project, ★Attached Here★.

OK frame Error Frame Error Rate
Single Bank Allocation 454 150 24.8%
Dual Bank Allocation 632 0 0%

5. Limitation

  • C32 has a limitation wherein the max possible frequency of DMA triggers from the Advance Timers (TIMA0_0 and TIMA0_1) is lesser compared to the BCLKBY2 domain timers, which may lead to data loss in high speed use case.
    • In the test to use timer capture + DMA to capture and decode ~5M baud rate Manchester code, TIMA cannot work while TIMG works well.

6. Reference