No CAN connection with colibri iMX7 and WEC library V2.0 (3859)

I have adapted the CAN demo project (from the current library) in order to address the iMX7 onboard CAN module. Can1.RX = SODIMM_90 and Can1.TX = SODIMM_92. The wiring on the Eval. Board (see “Colibri Evaluation Board Datasheet” chapter 3.9.1.4.2 CAN TX / RX (X38)) I have done. When I run the program (1. CAN Transmit), I always get the message “CAN Transmit error”. The changes in the code can be seen here:

int wmain(int argc, wchar_t *argv[])
{
	HANDLE hCan = NULL;

	BOOL isSelectionDone = FALSE;
	INT selectedOption;

	BOOL returnValue = FALSE;
	DWORD bitRate;
	DWORD busStatus;

	wprintf(L"Toradex CAN demo\r\n");

	// 1. Initialize CAN without affecting hardware registers
	hCan = Imx7Can_Init(L"CAN1");	// Internal CAN
	if (hCan == NULL)
	{
		printf("Error in CAN initialization\r\n");
	}
	// Define CAN-Pins and bitrate
	uIo ioRx = COLIBRI_PIN(90);
	uIo ioTx = COLIBRI_PIN(92);
	bitRate = 250000;

	returnValue = Imx7Can_SetConfigInt(hCan, L"ioTx", ioTx.GenericDefinition, StoreVolatile))
	returnValue = Imx7Can_SetConfigInt(hCan, L"ioRx", ioRx.GenericDefinition, StoreVolatile))
	returnValue = Imx7Can_SetConfigInt(hCan, L"BitRateHz", bitRate, StoreVolatile))
	returnValue = Imx7Can_SetConfigString(hCan, L"Implementation", L"FlexCAN", StoreVolatile); // use Vybrid internal CAN controller
	returnValue = Imx7Can_SetConfigString(hCan, L"FrameFormat", L"standard", StoreVolatile);     // Set FrameFormat
	returnValue = Imx7Can_SetConfigString(hCan, L"FilterRemote", L"none", StoreVolatile);     //
	returnValue = Imx7Can_SetConfigString(hCan, L"RtrFormat", L"data", StoreVolatile);     //
	returnValue = Imx7Can_SetConfigInt(hCan, L"FilterID", 0x00, StoreVolatile);     //
	returnValue = Imx7Can_SetConfigInt(hCan, L"FilterMask", 0x00, StoreVolatile);     //
	do
	{
		printf("\nOptions:\n");
		printf("1. CAN Transmit   2. CAN Receive   3. Quit\n\n");
		printf("Choose the option and press Enter key: ");
		scanf_s("%d", &selectedOption);
		printf("\n");

		/// Enter only if there is only one character entered from key board.
		switch (selectedOption)
		{
		case 1:
			/// CAN Transmit
			CanTxProcess(hCan);
			break;

		case 2:
			/// CAN Receive
			CanRxProcess(hCan);
			break;

		case 3:
			/// Quits the demo
			isSelectionDone = TRUE;
			break;

		default:
			printf("Invalid entry, try again!\n\n");
			isSelectionDone = FALSE;
		}
	} while (!isSelectionDone);

	/// 6. Deinit CAN channel
	Imx7Can_Deinit(hCan);

	return(TRUE);
}

Do you have any suggestions for me? Thanks in advance.

Hi, I had an error in the CAN connection. Now the program works fine. Thank you very much for your effort.

Hi,
Can you reboot the module and then try to run the application?
A possible reason for this error is that you may not have closed the application properly.
Let us know if the error still exists.