CAN IoT Card driver


#1

Hello,
I got this CAN module
http://www.taloncom.com/images/Talon%20mangOH%20CAN%20Bus%20Module%20Brief%202016.pdf

Is this the right tutorial for MangOH Red in order to get this CAN module to work?


#2

Yes, it is.
Let us know if you have any issues


#3

The link in step one is broken
"1. Download Legato Distribution Source Package from Sierra Wireless website:
Yocto Source (Around 3 GB)"


#4

Thanks. Fixed the link. You need to pick the latest toolchain package


#5

I have this «module. Do you have the schematic ? Not found on the web site.


#6

Nope, same problem…


#7

The link on the wiki is https://source.sierrawireless.com/resources/legato/downloads/

Is this the problem?


#8

Sorry Asyal, the link is ok, I ment the CAN module electrical schematic


#9

I have builded the new yocto image to support the CAN IoT card. I not see in menu config a way to add can-utils. For example candump is very good utility to monitor can message. Any way to add it in yocto ??? Thanks


#10

Hello

I have connected the CAN Iot card TALON to a can viewer.

I meet a problem.

I can send 1 can message only. The next message are not sent.
Any idea ??

This is my code (using socket CAN). Very basic…
Hello message is send but not the second message…

int can_loop(void)
{
struct ifreq ifr;
struct sockaddr_can addr;
struct can_frame frame;
int s;
memset(&ifr, 0x0, sizeof(ifr));
memset(&addr, 0x0, sizeof(addr));
memset(&frame, 0x0, sizeof(frame));
/* open CAN_RAW socket /
s = socket(PF_CAN, SOCK_RAW, CAN_RAW);
/
convert interface sting “can0” into interface index /
strcpy(ifr.ifr_name, “can0”);
ioctl(s, SIOCGIFINDEX, &ifr);
/
setup address for bind /
addr.can_ifindex = ifr.ifr_ifindex;
addr.can_family = PF_CAN;
/
bind socket to the can0 interface */
bind(s, (struct sockaddr )&addr, sizeof(addr));
/
first fill, then send the CAN frame */
frame.can_id = 0x23;
strcpy((char )frame.data, “hello”);
frame.can_dlc = 5;
write(s, &frame, sizeof(frame));
/
first fill, then send the CAN frame */
frame.can_id = 0x24;
strcpy((char *)frame.data, “iCC2012”);
frame.can_dlc = 7;
write(s, &frame, sizeof(frame));
close(s);
return 0;
}

COMPONENT_INIT
{

// Run the can-init.sh before advertising the service to ensure that the CAN device is
// available before we allow it to be used.
char line[256];
FILE* fp = popen("can_init.sh 2>&1", "r");
LE_ASSERT(fp != NULL);
while (fgets(line, sizeof(line), fp) != NULL)
{
	LE_INFO("can_init.sh output: %s", line);
}
int canInitResult = pclose(fp);
LE_FATAL_IF(!WIFEXITED(canInitResult), "Could not run can_init.sh");
const int canInitExitCode = WEXITSTATUS(canInitResult);
LE_FATAL_IF(canInitExitCode != 0, "can_init.sh failed with exit code %d", canInitExitCode);

can_loop();

}


#11

I suspect a patch problem. I not use the patch for the Mangoh Red…
I must rebuild the yocto linux distro…


#12

All is good now with the correct patch :slight_smile:


#13

hey,
can you suggest links related LoRa expansion card ?
Not found any useful data related to it?
any documentation releted to it will be really useful