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.

MCU-PLUS-SDK-AM243X: Integrating enet_cpsw_tcpserver and ospi_flash_io examples together

Part Number: MCU-PLUS-SDK-AM243X
Other Parts Discussed in Thread: SYSCONFIG

Hi,

I'm trying to integrate the TCP server and the OSPI Flash IO example together to create a program where the following happens:

1. Receive data over TCP

2. Write it in OSPI Flash

3. Read it from OSPI Flash

4. Send the data back over TCP

The examples both run fine seperately, without problems. However the OSPI example is WITHOUT FreeRTOS, so when now integrating them, I think because of that writing to OSPI does not work.

For reference, this is my code, and I call the flashWriteData() and flashReadData() functions from the AppTcp_echoPckt function when receiving data from TCP, nothing special, data is received correctly.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <kernel/dpl/DebugP.h>
#include "ti_drivers_open_close.h"
#include "ti_board_open_close.h"
#include <string.h>
#include "app_qspi.h"
#define APP_OSPI_DATA_SIZE (2048)
#define APP_OSPI_FLASH_OFFSET_BASE (0x200000U)
uint8_t gOspiTxBuf[APP_OSPI_DATA_SIZE];
/* read buffer MUST be cache line aligned when using DMA, we aligned to 128B though 32B is enough */
uint8_t gOspiRxBuf[APP_OSPI_DATA_SIZE] __attribute__((aligned(128U)));
void ospi_flash_clear_buffers()
{
uint32_t i;
for(i = 0U; i < APP_OSPI_DATA_SIZE; i++)
{
gOspiTxBuf[i] = 0U;
gOspiRxBuf[i] = 0U;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I also configured the Flash and OSPI in exactly the same way as in the example sysconfig. (I do have to disable PHY, because else it does not run, I think because of the use of Ethernet)

I have now two DMA's configured, one seperate one for Ethernet and one for OSPI. (PKTDMA_0 for Ethernet and BCDMA_0 for OSPI)

I get the following error: Flash Write of 5 bytes failed at 0x200000 offset !!!

Basicly saying that writing does not work, however the Flash_eraseBlk() and Flash_read() functions go without error.

So I have kept most of my code the same as in the example, just seperated read and write in seperate functions.

I feels like a WEL (write enable latch) type of problem, but the seperate OSPI example works fine, so I don't know where to look now.