I am looking for advice about CAN communication.
I have Micromedia HMI 7" (https://www.mikroe.com/mikromedia-hmi-70-no-touch), micromedia HMI Break Board (https://www.mikroe.com/mikromedia-hmi-breakout) and source sending CAN messages. In this case it is arduino.
And pins are connected like this:
CAN1 RX -> CAM-PWDN
CAN1 TX -> CAM-D0
or
CAN0 RX -> CAM-D1
CAN0 TX -> CAM-D2
But I am not able to get CAN message from CAN0 nor CAN1 anyway.
I was looking for throught your forum for some advice. I found this topic (viewtopic.php?f=204&t=65113) then I took example for CAN from EasyFT90x folder, but still I was not able to get CAN bus working.
I am using microC PRO for FT90X and my code is following:
Code: Select all
#include "__Can.h"
#include "__Can_Hw_Map.h"
#include "CANTest_objects.h"
uint32_t flags;
TCANMsg msg;
void main() {
InitVTFTStack();
UART1_Init(9600);
Delay_100ms;
CAN_SysInit(CAN1);
if(CAN_OK == CAN_Init(CAN1,500)){
UART1_Write_Text("CAN1 INIT OK \r\n");
}
while (1) {
if (CAN_OK == CANx_Read(CAN1, &msg.ID, &msg.buf, &msg.len, &flags)){
UART1_Write_Text("CAN1 READ \r\n");
if (msg.len){
UART1_Write_Text("CAN1 LEN CONDITION \r\n");
}
}
ProcessVTFTStack();
}
}
Is something wrong there or missing?
Why I am able to get CAN_OK status from CANx_Read() but no message?
And how is possible, that I get CAN_OK status from CANx_Read() with no pins connected to CAN bus?