[Microchip]/dsPIC2011. 12. 4. 22:45

[dsPIC EVM] MP3 Module (VS1033) 테스트

[dsPIC EVM] MP3 Module (VS1033) 테스트



[NET EVM] 보드를 이용하면 W5100과 같은 이더넷 모듈이나 TFT LCD 모듈을 연결하여 테스트 할수 있고 VS1033과 같은 MP3 모듈을 연결하여 네트웍 라디오를 테스트 해 볼 수 있다.





ADC0 -> RB0



dsPIC33 MP3모듈 HAL Driver 코드
//-----------------------------------------------------------------------------
// VS1033 모듈 HAL
#define VS_DREQ_BIT      BIT6
#define VS_DREQ_PORT     PORTB

#define VS_CS_BIT      BIT4
#define VS_CS_PORT      PORTB

#define VS_XDCS_BIT      BIT5
#define VS_XDCS_PORT     PORTB

#define VS_RST_BIT      BIT3
#define VS_RST_PORT      PORTB

#define VS1003_CS_H()      Sbi(VS_CS_PORT, VS_CS_BIT)
#define VS1003_CS_L()      Cbi(VS_CS_PORT, VS_CS_BIT)

#define vs1003_enable()      VS1003_CS_L()
#define vs1003_disable()     VS1003_CS_H()

#define VS1003_XDCS_H()      Sbi(VS_XDCS_PORT, VS_XDCS_BIT)
#define VS1003_XDCS_L()      Cbi(VS_XDCS_PORT, VS_XDCS_BIT)


#define VS1003_RESET_H()     //Sbi(VS_RST_PORT, VS_RST_BIT)
#define VS1003_RESET_L()     //Cbi(VS_RST_PORT, VS_RST_BIT)

#define IsVs1003DataReady()     (GPIOA->IDR&VS_DREQ_BIT)

#define VS_SendByte       SPI1_WriteReadByte
#define VS_InitSpi()      SPI1_Init()
#define VS_SpiSpeed_Low()        SPI1_SetSpeed(SPI_SPEED_1MHZ)
#define VS_SpiSpeed_High()     SPI1_SetSpeed(SPI_SPEED_4MHZ)


#define MP3_PORT_INIT()      Cbi(TRISB, BIT3|BIT4|BIT5);Sbi(TRISB, BIT6);\
                                         VS1003_CS_H();VS1003_XDCS_H();VS1003_RESET_H()
//-----------------------------------------------------------------------------



dsPIC33 SD Card HAL Driver 코드
#define _SPI1_ENABLE    1

//-----------------------------------------------------------------------------
// SD Card HAL
#define _DEBUG_FAT_FILE                 1

#define MMC_CS_PORT      LATB
#define MMC_CS_BIT      BIT7

#define MMC_CS_INIT()     TRISB=0;MMC_CS_HIGH();

#define MMC_CS_HIGH()     Sbi(MMC_CS_PORT, MMC_CS_BIT)
#define MMC_CS_LOW()     Cbi(MMC_CS_PORT, MMC_CS_BIT)
#define MMC_ASSERT_INIT()    MMC_CS_INIT();MMC_CS_HIGH()
#define MMC_ASSERT()     MMC_CS_LOW()
#define MMC_DEASSERT()     MMC_CS_HIGH()


#define MMC_SpiInit()     SPI1_Init()
#define MMC_SendByte     SPI1_WriteReadByte
#define MMC_Send(Data)      SPI1_WriteByte(Data)
#define MMC_Recv()      SPI1_WriteReadByte(0xFF)
#define MMC_RecvP(Data)     MMC_Send(0xFF); (*(Data)=SPI1_ReadByte())
#define MMC_SPISpeed     SPI1_SetSpeed

#define SPI_Mode3()

#define FAT_MAX_NUM_FILE          50

#define FCLK_SLOW()             MMC_SPISpeed(SPI_SPEED_1MHZ) 
#define FCLK_FAST()             MMC_SPISpeed(SPI_SPEED_MAX)
//-----------------------------------------------------------------------------
Posted by nexp

댓글을 달아 주세요