SPI dynamic drivers , running 2 clients issues
MPBLAB 3.45, Harmony 1.06 , pic32mx795...
The demo code in harmony for accessing the eeprom chip , SST25VF020B, works correctly for me.
I also have a SPI thermomneter on my board, and I want to use the same SPI instance (SPI1), for both chips.
I assume this is 2 clients on one SPI instance, for dymanic drivers.
When running by themsleves , the eerom chip and the thermometer code works fine (dynamic mode), but when I try run the code together , I get the issue shown below...
Here is my Thermometer code:
//open up a handle, this works correctly
appData.SPIHandle = DRV_SPI_Open(DRV_SPI_INDEX_0, DRV_IO_INTENT_READWRITE );
if(appData.SPIHandle != (uintptr_t)NULL)
// all good
appData.state = TEMP_SEND_SETUP_CMD;
SYS_CONSOLE_MESSAGE("Issue opening driver here... \r\n");
//setup commands for thermometer
appData.TXbuffer = 0x80; /* EEPROM Read Opcode */
appData.TXbuffer = 0; /* Address - LSB */
appData.TXbuffer = 0xf8; /* Address - MSB */
appData.TXbuffer = 0; /* Dummy byte */
//HERE THE CODE FAILS. I GET A SYSTEM CRASH ( _general_exception_handler)
appData.Write_Buffer_Handle = DRV_SPI_BufferAddWrite2(
appData.SPIHandle,(uint8_t *)&appData.TXbuffer, 4, NULL, NULL,NULL);
ON stepping into the line of code above we go here...
DRV_SPI_BUFFER_HANDLE DRV_SPI_BufferAddWrite2 ( DRV_HANDLE handle, void *txBuffer,
size_t size, DRV_SPI_BUFFER_EVENT_HANDLER completeCB, void * context, DRV_SPI_BUFFER_HANDLE * jobHandle )
//And it is the line below the crashes...
DRV_SPI_CLIENT_OBJECT * pClient = (DRV_SPI_CLIENT_OBJECT *)handle;
struct DRV_SPI_DRIVER_OBJECT * pDrvObject = pClient->driverObject;
I cannot understand why it is crashes here..It is somehow interfering with the driver instance for the eeprom?
I have attached the following files below:
system_init, system_inturrupt, system_tasks,