Can embedded in FPGA

Post your suggestions for new tutorials or anything here!
Post Reply
inter_antonio
Posts: 1
Joined: July 15th, 2014, 11:10 am

Can embedded in FPGA

Post by inter_antonio » July 15th, 2014, 4:05 pm

Hello.
We are working with the module CAN 2.0. We are transmiting CAN protocol between a spartan 6 and a freescale microcontroller.
We can send information from the spartan to the microcontroller and we received it fine, but when we send information from the microcontroller to the FPGA,
we can see the information on the memory window, after that when the programm call the next function the information is deleted.
The program is below.


static void RecvHandler(void *CallBackRef)
//************************Interrup callback Handler
Status = XCan_Recv(CanPtr, RxFrame);
//************************In Memory Map, we can see the received data

//*****************Once we jump onto XCan_Recv Function, the memory CAN offset is deleted
//*****************we are unable to read from the offset
int XCan_Recv(XCan *InstancePtr, volatile u32 *FramePtr)
{
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
/*
* Check if RX FIFO has frame(s) sitting in it. If not, return error
* code
*/
if (XCan_IsRxEmpty(InstancePtr) == TRUE) {
return XST_NO_DATA;
}
/* Read IDR */
FramePtr[0] =
XCan_ReadReg(InstancePtr->BaseAddress, XCAN_RXFIFO_ID_OFFSET);
/* Read DLC */
FramePtr[1] =
XCan_ReadReg(InstancePtr->BaseAddress, XCAN_RXFIFO_DLC_OFFSET);
/* Read Data Word 1 */
FramePtr[2] =
XCan_ReadReg(InstancePtr->BaseAddress, XCAN_RXFIFO_DW1_OFFSET);
//FramePtr[2] = (u32*)(0x43C20058);
/* Read Data Word 2 */
FramePtr[3] =
XCan_ReadReg(InstancePtr->BaseAddress, XCAN_RXFIFO_DW2_OFFSET);
/*
* Clear RXNEMP bit in ISR. This allows future XCan_IsRxEmpty() call
* returns correct RX FIFO occupancy/empty condition.
*/
XCan_InterruptClear(InstancePtr, XCAN_IXR_RXNEMP_MASK);
return XST_SUCCESS;
}

Any idea? What is the problem?

Post Reply