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.

MSP430FR4133: Interfacing with DFPlayer Mini

Part Number: MSP430FR4133

Hi all, im trying to interface my MSP430 with an external Mini MP3 audio player. Datasheet here However, i cannot figure out why this code is not playing any of the audio files stored on the sd card i have connected, the hardware itself is definitely functional as i can run the audio files using buttons etc. but whenever data is sent to the player itself through the MSP, there is not output.
This is my main.c file here. 
I have also uploaded my DFP.c and DFPlayer.h code, this was sourced from Github.

#include <msp430.h>
#include <intrinsics.h>
#include <stdlib.h>
#include <DFPlayer.h>

void Uart_Init(void) {
    P1SEL0 |= BIT0 | BIT1;  // Set P1.0 and P1.1 to UART function
    UCA0CTLW0 |= UCSWRST;   // Enable software reset
    UCA0CTLW0 |= UCSSEL__SMCLK;  // Use SMCLK
    UCA0BR0 = 52;  // Baud rate setting for 9600 bps with 4MHz SMCLK
    UCA0BR1 = 0x00;
    UCA0MCTLW = 0x4900 | UCOS16 | UCBRF_1;  // Modulation settings
    UCA0CTLW0 &= ~UCSWRST;  // Disable software reset
}

void UART_Send_Data(unsigned char data) {
    while (!(UCA0IFG & UCTXIFG));  // Wait for TX buffer to be ready
    UCA0TXBUF = data;  // Transmit data
}

unsigned char UART_Read_Data(void) {
    if (UCA0IFG & UCRXIFG) { // Check if the receive buffer is full
        return UCA0RXBUF;  // Return received data
    }
    return 0; // Return 0 if no data is available
}

void Send_Command(unsigned char cmd, unsigned char feedback, unsigned char param1, unsigned char param2) {
    unsigned char command[10];
    unsigned int checksum = 0;
    int i;  // Move declaration to the start of the function

    command[0] = 0x7E;
    command[1] = 0xFF;
    command[2] = 0x06;
    command[3] = cmd;
    command[4] = feedback;
    command[5] = (char)(param1 >> 8);
    command[6] = (char)param1;

    for (i = 1; i < 7; i++) {
        checksum += command[i];
    }
    checksum = 0xFFFF - checksum + 1;
    command[7] = (checksum >> 8) & 0xFF;
    command[8] = checksum & 0xFF;
    command[9] = 0xEF;

    for (i = 0; i < 10; i++) {
        UART_Send_Data(command[i]);
    }
}

void Set_Volume(int volume) {
    if (volume < 0) volume = 0;
    if (volume > 30) volume = 30;
    Send_Command(0x06, 0, 0, volume);  // Command to set volume
}

void Play_Audio_File() {
    Set_Volume(25);  // Set volume to a clearly audible level
    Send_Command(0x03, 0x00, 0x00, 0x01);  // Command to play track number 1
}

void UART_Send_String(const char *str) {
    while (*str) {
        UART_Send_Data(*str++);
    }
}

void print_response(unsigned char response) {
    switch (response) {
        case 0x3A:
            UART_Send_String("Init complete\n");
            break;
        case 0x41:
            UART_Send_String("Error\n");
            break;
        case 0x40:
            UART_Send_String("ACK\n");
            break;
        default:
            UART_Send_String("Unknown response\n");
            break;
    }
}

int main(void) {
    WDTCTL = WDTPW | WDTHOLD;  // Stop watchdog timer
    Uart_Init();               // Initialize UART

    __delay_cycles(500000);    // Wait for DFPlayer Mini to initialize

    Play_Audio_File();         // Play the audio file "001.mp3" from the SD card

    while (1) {
        if (UCA0IFG & UCRXIFG) {
            unsigned char response = UART_Read_Data();  // Continuously read data from DFPlayer
            print_response(response);
        }
    }
}
#include "DFPlayer.h"

void DFPlayer_send_cmd(struct DFPlayer *player, char cmd,int16_t parameter)
{
    char buffer[10];
    int16_t CRC;
    CRC = -(0xFF + 0x06 + cmd + (parameter>>8) + parameter);
    buffer[0] = 0x7E;
    buffer[1] = 0xFF;
    buffer[2] = 0x06;
    buffer[3] = cmd;
    buffer[4] = 0x00;
    buffer[5] = (char)(parameter>>8);
    buffer[6] = (char)parameter;
    buffer[7] = (char)(CRC>>8);
    buffer[8] = (char)CRC;
    buffer[9] = 0xEF;

    player->send(buffer, 10);
}
#ifndef DFPLAYER_H
#define DFPLAYER_H

#include <stdint.h>

#define DFPLAYER_CMD_NEXT 0x01
#define DFPLAYER_CMD_PRESVIOUS 0x02
#define DFPLAYER_CMD_TRACK 0x03
#define DFPLAYER_CMD_VOLUME_P 0x04
#define DFPLAYER_CMD_VOLUME_M 0x05
#define DFPLAYER_CMD_VOL_MANU 0x06
#define DFPLAYER_CMD_EQ 0x07
#define DFPLAYER_CMD_MODE 0x08
#define DFPLAYER_CMD_STDBY 0x0A
#define DFPLAYER_CMD_NORMAL 0x0B
#define DFPLAYER_CMD_RESET 0x0C
#define DFPLAYER_CMD_PLAYBACK 0x0D
#define DFPLAYER_CMD_PAUSE 0x0E
#define DFPLAYER_CMD_FOLDER 0x0F
#define DFPLAYER_CMD_VOL_ADJ 0x10
#define DFPLAYER_CMD_REPEAT 0x11

#define DFPLAYER_QRY_PARAM 0x3F
#define DFPLAYER_QRY_ERROR 0x40
#define DFPLAYER_QRY_REPLY 0x41
#define DFPLAYER_QRY_CUR_STAT 0x42
#define DFPLAYER_QRY_CUR_VOL 0x43
#define DFPLAYER_QRY_CUR_EQ 0x44
#define DFPLAYER_QRY_CUR_MODE 0x45
#define DFPLAYER_QRY_CUR_VER 0x46
#define DFPLAYER_QRY_N_TF_FILE 0x47
#define DFPLAYER_QRY_N_USB_FILE 0x48
#define DFPLAYER_QRY_N_FLSH_FILE 0x49
#define DFPLAYER_QRY_KEEP_ON 0x4A
#define DFPLAYER_QRY_TF_TRACK 0x4B
#define DFPLAYER_QRY_USB_TRACK 0x4C
#define DFPLAYER_QRY_FLASH_TRACK 0x4D

#define DFPLAYER_USB_ONLINE                                        \
    {                                                              \
        0x7E, 0xFF, 0x06, 0x3F, 0x00, 0x00, 0x01, 0xFF, 0xC0, 0xEF \
    }
#define DFPLAYER_SD_ONLINE                                         \
    {                                                              \
        0x7E, 0xFF, 0x06, 0x3F, 0x00, 0x00, 0x02, 0xFF, 0xBF, 0xEF \
    }
#define DFPLAYER_USB_SD_ONLINE                                     \
    {                                                              \
        0x7E, 0xFF, 0x06, 0x3F, 0x00, 0x00, 0x03, 0xFF, 0xBE, 0xEF \
    }
#define DFPLAYER_PC_ONLINE                                         \
    {                                                              \
        0x7E, 0xFF, 0x06, 0x3F, 0x00, 0x00, 0x04, 0xFF, 0xBD, 0xEF \
    }
#define DFPLAYER_FLASH_ONLINE                                      \
    {                                                              \
        0x7E, 0xFF, 0x06, 0x3F, 0x00, 0x00, 0x08, 0xFF, 0xB9, 0xEF \
    }

#define DFPLAYER_USB_PUSH_IN                                       \
    {                                                              \
        0x7E, 0xFF, 0x06, 0x3A, 0x00, 0x00, 0x01, 0xFF, 0xC5, 0xEF \
    }
#define DFPLAYER_SD_PUSH_IN                                        \
    {                                                              \
        0x7E, 0xFF, 0x06, 0x3A, 0x00, 0x00, 0x02, 0xFF, 0xC4, 0xEF \
    }
#define DFPLAYER_USB_PUSH_OUT                                      \
    {                                                              \
        0x7E, 0xFF, 0x06, 0x3B, 0x00, 0x00, 0x01, 0xFF, 0xC4, 0xEF \
    }
#define DFPLAYER_SD_PUSH_OUT                                       \
    {                                                              \
        0x7E, 0xFF, 0x06, 0x3B, 0x00, 0x00, 0x02, 0xFF, 0xC3, 0xEF \
    }

typedef uint8_t (*dfplayer_send_fptr)(uint8_t *data, uint32_t length);

struct DFPlayer {
    dfplayer_send_fptr send;
};

void DFPlayer_send_cmd(struct DFPlayer *player, char cmd,int16_t parameter);

#endif /* DFPLAYER_H */

**Attention** This is a public forum