cancel
Showing results for 
Search instead for 
Did you mean: 

SPI1 and SPI2 together ?

antonius
Senior
Posted on February 17, 2016 at 23:14

Guys,

Can I use SPI1 as VS1053 and SPI2 as SDcard, It seems that after VS1053 initialized, it can not read SDcard ?? why is that ? Thanks

void Init_FAT() {
char FAT_cnt = 0;
if (Fat_Initialized_Flag == 0) {
// Initialize SPI2 module
SPI2_Init_Advanced(_SPI_FPCLK_DIV16, _SPI_MASTER | _SPI_8_BIT |
_SPI_CLK_IDLE_LOW | _SPI_FIRST_CLK_EDGE_TRANSITION |
_SPI_MSB_FIRST | _SPI_SS_DISABLE | _SPI_SSM_ENABLE | _SPI_SSI_1,
&_GPIO_MODULE_SPI2_PB13_14_15);
while ((Fat32_Init() != 0) && (FAT_cnt < 5))
Fat_cnt ++;
if (FAT_cnt < 5){
Fat_Initialized_Flag = 1;
// Initialize SPI2 module
SPI2_Init_Advanced(_SPI_FPCLK_DIV4, _SPI_MASTER | _SPI_8_BIT |
_SPI_CLK_IDLE_LOW | _SPI_FIRST_CLK_EDGE_TRANSITION |
_SPI_MSB_FIRST | _SPI_SS_DISABLE | _SPI_SSM_ENABLE | _SPI_SSI_1,
&_GPIO_MODULE_SPI2_PB13_14_15);
UART1_Write_Text(''1. FAT32 Initialized\n'');
//TFT_Write_Text(''1. FAT32 Initialized'', 90, 55);
}
}
// read_file();
}
void MP3_Start() {
// MP3_CS, MP3_RST and BSYNC are outputs
MP3_CS = 1; // Deselect MP3_CS
MP3_RST = 1; // Set MP3_RST pin
BSYNC = 0; // Clear BSYNC
BSYNC = 1; // Clear BSYNC
// Initialize SPI1 module
SPI1_Init_Advanced(_SPI_FPCLK_DIV16, _SPI_MASTER | _SPI_8_BIT |
_SPI_CLK_IDLE_LOW | _SPI_FIRST_CLK_EDGE_TRANSITION |
_SPI_MSB_FIRST | _SPI_SS_DISABLE | _SPI_SSM_ENABLE | _SPI_SSI_1,
&_GPIO_MODULE_SPI1_PA567);
MP3_Set_Default_Mode();
// Initialize SPI1 module at higher speed
SPI1_Init_Advanced(_SPI_FPCLK_DIV4, _SPI_MASTER | _SPI_8_BIT |
_SPI_CLK_IDLE_LOW | _SPI_FIRST_CLK_EDGE_TRANSITION |
_SPI_MSB_FIRST | _SPI_SS_DISABLE | _SPI_SSM_ENABLE | _SPI_SSI_1,
&_GPIO_MODULE_SPI1_PA567);
Delay_ms(200);
level = 0;
MP3_Set_Volume(level, level);
MP3_Reset_Time();
UART1_Write_Text(''2. MP3 Initialized\n'');
//TFT_Write_Text(''2. MP3 Initialized'', 90, 75);
}

1 REPLY 1
Posted on February 18, 2016 at 21:01

Should be viable, you'd need to review what the library you are using is doing, doesn't look familiar.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..