Other Parts Discussed in Thread: EK-TM4C1294XL
i am using dk-tm4c129x tiva board .
in that i am using on board spi flash memory (MX25L25635F)
i am write two way code in that my buffer size is 105535
1)only flash write
2)only flash read
in that am successfully work sequentially upload but when i am murge both code read or write that in not work properly . in that merge code only 60 bytes read or write properly more than 60 bytes in upload then code is not working.
i want 105535 byte read or write.
in that read_write code is not work.
write_spi
// usb_dev_msc.c - Main routines for the device mass storage class example. // write_spi #include <stdbool.h> #include <stdint.h> #include "inc/hw_memmap.h" #include "driverlib/gpio.h" #include "driverlib/rom.h" #include "driverlib/rom_map.h" #include "driverlib/pin_map.h" #include "driverlib/sysctl.h" #include "driverlib/systick.h" #include "driverlib/udma.h" #include "grlib/grlib.h" #include "usblib/usblib.h" #include "usblib/device/usbdevice.h" #include "usblib/device/usbdmsc.h" #include "utils/ustdlib.h" #include "fatfs/src/diskio.h" #include "drivers/frame.h" #include "drivers/kentec320x240x16_ssd2119.h" #include "drivers/mx66l51235f.h" #include "drivers/pinout.h" #include "usbdspiflash.h" #include "usb_msc_structs.h" #define NUM_SSI_DATA 105535 //*************************** // // Graphics context used to show text on the display. // //*************************** tContext g_sContext; //*************************** // // A buffer used for updating the read/write counts. // //*************************** uint8_t g_pcBuffer[NUM_SSI_DATA]; uint8_t Data[NUM_SSI_DATA]; //*************************** // // The system clock frequency in Hz. // //*************************** uint32_t g_ui32SysClock; //*************************** // // The error routine that is called if the driver library encounters an error. // //*************************** #ifdef DEBUG void _error_(char *pcFilename, uint32_t ui32Line) { } #endif //*************************** // // This is the main loop that runs the application. // //*************************** int main(void) { uint32_t ui32Read, ui32Write,ui32Index; uint32_t ui32PLLRate; // // Run from the PLL at 120 MHz. // g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000); for(ui32Index=0;ui32Index<NUM_SSI_DATA;ui32Index++) { Data[ui32Index]=ui32Index/5; g_pcBuffer[ui32Index]=0; } // // Configure the device pins. // PinoutSet(); // // Initialize the display driver. // Kentec320x240x16_SSD2119Init(g_ui32SysClock); // // Initialize the graphics context. // GrContextInit(&g_sContext, &g_sKentec320x240x16_SSD2119); // // Draw the application frame. // FrameDraw(&g_sContext, "usb-dev-msc"); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOQ); while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOQ)) { } GPIOPinTypeGPIOOutput(GPIO_PORTQ_BASE, GPIO_PIN_7); // // Enable the SSI3 used by SPI flash. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI3); ROM_SysCtlPeripheralReset(SYSCTL_PERIPH_SSI3); // // Configure and enable uDMA // MX66L51235FInit(g_ui32SysClock); USBDMSCStorageWrite(0, Data, 0,NUM_SSI_DATA);//write buffer SysCtlDelay(g_ui32SysClock/10); while(1) { uint8_t c=!c; GPIOPinWrite(GPIO_PORTQ_BASE, GPIO_PIN_7,c<<7); SysCtlDelay(g_ui32SysClock/10000); } }
//read_spi #include <stdbool.h> #include <stdint.h> #include "inc/hw_memmap.h" #include "driverlib/gpio.h" #include "driverlib/rom.h" #include "driverlib/rom_map.h" #include "driverlib/pin_map.h" #include "driverlib/sysctl.h" #include "driverlib/systick.h" #include "driverlib/udma.h" #include "grlib/grlib.h" #include "usblib/usblib.h" #include "usblib/device/usbdevice.h" #include "usblib/device/usbdmsc.h" #include "utils/ustdlib.h" #include "fatfs/src/diskio.h" #include "drivers/frame.h" #include "drivers/kentec320x240x16_ssd2119.h" #include "drivers/mx66l51235f.h" #include "drivers/pinout.h" #include "usbdspiflash.h" #include "usb_msc_structs.h" #define NUM_SSI_DATA 105535 //*************************** // // Graphics context used to show text on the display. // //*************************** tContext g_sContext; //*************************** // // A buffer used for updating the read/write counts. // //*************************** uint8_t g_pcBuffer[NUM_SSI_DATA]; uint8_t Data[NUM_SSI_DATA]; //*************************** // // The system clock frequency in Hz. // //*************************** uint32_t g_ui32SysClock; //*************************** // // The error routine that is called if the driver library encounters an error. // //*************************** #ifdef DEBUG void _error_(char *pcFilename, uint32_t ui32Line) { } #endif //*************************** // // This is the main loop that runs the application. // //*************************** int main(void) { uint32_t ui32Read, ui32Write,ui32Index; uint32_t ui32PLLRate; // // Run from the PLL at 120 MHz. // g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000); for(ui32Index=0;ui32Index<NUM_SSI_DATA;ui32Index++) { Data[ui32Index]=ui32Index/5; g_pcBuffer[ui32Index]=0; } // // Configure the device pins. // PinoutSet(); // // Initialize the display driver. // Kentec320x240x16_SSD2119Init(g_ui32SysClock); // // Initialize the graphics context. // GrContextInit(&g_sContext, &g_sKentec320x240x16_SSD2119); // // Draw the application frame. // FrameDraw(&g_sContext, "usb-dev-msc"); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOQ); while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOQ)) { } GPIOPinTypeGPIOOutput(GPIO_PORTQ_BASE, GPIO_PIN_7); // // Enable the SSI3 used by SPI flash. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI3); ROM_SysCtlPeripheralReset(SYSCTL_PERIPH_SSI3); // // Configure and enable uDMA // MX66L51235FInit(g_ui32SysClock); USBDMSCStorageRead(0, g_pcBuffer, 0,NUM_SSI_DATA);//read buffer while(1) { uint8_t c=!c; GPIOPinWrite(GPIO_PORTQ_BASE, GPIO_PIN_7,c<<7); SysCtlDelay(g_ui32SysClock/10000); } }
// read_ write_spi #include <stdbool.h> #include <stdint.h> #include "inc/hw_memmap.h" #include "driverlib/gpio.h" #include "driverlib/rom.h" #include "driverlib/rom_map.h" #include "driverlib/pin_map.h" #include "driverlib/sysctl.h" #include "driverlib/systick.h" #include "driverlib/udma.h" #include "grlib/grlib.h" #include "usblib/usblib.h" #include "usblib/device/usbdevice.h" #include "usblib/device/usbdmsc.h" #include "utils/ustdlib.h" #include "fatfs/src/diskio.h" #include "drivers/frame.h" #include "drivers/kentec320x240x16_ssd2119.h" #include "drivers/mx66l51235f.h" #include "drivers/pinout.h" #include "usbdspiflash.h" #include "usb_msc_structs.h" #define NUM_SSI_DATA 105535 //*************************** // // Graphics context used to show text on the display. // //*************************** tContext g_sContext; //*************************** // // A buffer used for updating the read/write counts. // //*************************** uint8_t g_pcBuffer[NUM_SSI_DATA]; uint8_t Data[NUM_SSI_DATA]; //*************************** // // The system clock frequency in Hz. // //*************************** uint32_t g_ui32SysClock; //*************************** // // The error routine that is called if the driver library encounters an error. // //*************************** #ifdef DEBUG void _error_(char *pcFilename, uint32_t ui32Line) { } #endif //*************************** // // This is the main loop that runs the application. // //*************************** int main(void) { uint32_t ui32Read, ui32Write,ui32Index; uint32_t ui32PLLRate; // // Run from the PLL at 120 MHz. // g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000); for(ui32Index=0;ui32Index<NUM_SSI_DATA;ui32Index++) { Data[ui32Index]=ui32Index/5; g_pcBuffer[ui32Index]=0; } // // Configure the device pins. // PinoutSet(); // // Initialize the display driver. // Kentec320x240x16_SSD2119Init(g_ui32SysClock); // // Initialize the graphics context. // GrContextInit(&g_sContext, &g_sKentec320x240x16_SSD2119); // // Draw the application frame. // FrameDraw(&g_sContext, "usb-dev-msc"); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOQ); while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOQ)) { } GPIOPinTypeGPIOOutput(GPIO_PORTQ_BASE, GPIO_PIN_7); // // Enable the SSI3 used by SPI flash. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI3); ROM_SysCtlPeripheralReset(SYSCTL_PERIPH_SSI3); // // Configure and enable uDMA // MX66L51235FInit(g_ui32SysClock); USBDMSCStorageWrite(0, Data, 0,NUM_SSI_DATA);//write buffer SysCtlDelay(g_ui32SysClock/10); USBDMSCStorageRead(0, g_pcBuffer, 0,NUM_SSI_DATA);//read buffer while(1) { uint8_t c=!c; GPIOPinWrite(GPIO_PORTQ_BASE, GPIO_PIN_7,c<<7); SysCtlDelay(g_ui32SysClock/10000); } }