cancel
Showing results for 
Search instead for 
Did you mean: 

ways to interface a serial communication on STM32 excluding FatFs

Apill
Senior

I am currently using MDK essential version which allows me to use the following: all the mdk tools and software pack related to device and CMSIS but not middle ware.

I am doing a project in which i will have to store the values of motor vibration from accelerometer and have to do a digital signal processing on the stored values. I intially purchased a sd card and break out board and realized that , As a MDK essential version member i cannot use a file system!! In order to use a file system I will have to pay around 3000$ and upgrade my license to MDK essential plus.

Apart from storing the values through file system, what are the other ways in which i can store the values via serial communication ??? which eliminates the use of file system. are there any other ways????

I am not sure how much space i would need but i will have to take atleast 5k samples in one second.

4 REPLIES 4
Pavel A.
Evangelist III

> As a MDK essential version member i cannot use a file system!! 

It's annoying, but not a show stopper.

You can write to a SD card without a file system.

If you definitely want a filesystem - Just use the free fatfs component from ST.

CubeMX supports it. Some people even got it working with SD storage.

-- pa

You can use SDIO and FATFS without using any Keil middleware.​

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

Perhaps describe what STM32 specifically you are using, and what interfaces you have on the board. Serial can stream at high rates. You could use some packet protocol and write a PC side application to sink the data and write to log files.​

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

VisualStudio and VisualGDB is only $150... seems very stable to me...

did you see the AT25DN256 ? flash 256Kb (32K x 😎 34c each...

https://www.digikey.com/product-detail/en/adesto-technologies/AT25DN256-SSHF-T/1265-1120-1-ND/4702551

void writeFlashBytes(uint32_t address, int length, char*ptr){
    
 
    enableFlashWrites();
    
    
    HAL_GPIO_WritePin(AT25DN256_nSS_GPIO_Port, AT25DN256_nSS_Pin, GPIO_PIN_RESET);
    
    transfer(BytePageProgram);
    char addressByte2 =  (address >> 16) & 0xff;
    char addressByte1 =  (address >> 8) & 0xff;
    char addressByte0 =  (address)     & 0xff;
 
    char dummyByte = 0;
    transfer(addressByte2);
    transfer(addressByte1);
    transfer(addressByte0);
    
    while(length--)
    {        
        transfer(*ptr++);
    } 
 
           // this is needed to be sure the last byte is out of the pin before we drop the nSS
       while (!(hspi1.Instance->SR  & SPI_FLAG_TXE)) ;
       while ((hspi1.Instance->SR  & SPI_FLAG_BSY)) ;    
    
    //putc1(RxSPI);
    HAL_GPIO_WritePin(AT25DN256_nSS_GPIO_Port, AT25DN256_nSS_Pin, GPIO_PIN_SET);    
    
    disableFlashWrites();
    
    
}
void transfer(unsigned short data) {   // send only //as fast as possible
    char RxSPI;
   
    while (!(hspi1.Instance->SR  & SPI_FLAG_TXE)) ;
    *((__IO uint8_t *)&hspi1.Instance->DR) =  data;
            RxSPI = hspi1.Instance->DR;// + readSPI_SR;    // read Rx byte and discard, only clearing the buffer
}
 
char transfer_receive(unsigned short data) {   // send and receive byte
 
    char RxSPI;                                                     
    while(!(hspi1.Instance->SR  & SPI_FLAG_TXE))    // make sure the last byte is gone.
         ;
    while ((hspi1.Instance->SR  & SPI_FLAG_RXNE))  
     RxSPI = hspi1.Instance->DR;                    //empty and dump all fifo bytes
 
    *((__IO uint8_t *)&hspi1.Instance->DR) = data;  // force the SPI to transceive 8 bit
    while(!(hspi1.Instance->SR  & SPI_FLAG_TXE))    // wait to transmitter double buffer to shift into transmitter
         ;                   
    while ((hspi1.Instance->SR  & SPI_FLAG_BSY)) ;  // wait for data to shift out of the processor pins
    while((hspi1.Instance->SR  & SPI_FLAG_RXNE))   // load all the bytes received, only keep the last one
        RxSPI = hspi1.Instance->DR;               // we only want the last byte
 
    return RxSPI;
}