CAN communication connection is normal when there is no problem.
When a failure in the connection to the CAN communication (EX: reception Board SYSTEM POWER OFF)
Until the CAN communication is normally recovered
Our products, such as stopped.
Attach the configuration code.
TCANMsg msg, rcv; // can stuct
msg.ID = 0x200;
msg.len = 1;
IRQ_CTRL.B31 = 0; // GOLOBAL INTERRUPT ENABLE
CAN_SysInit(CAN1); // can1 system init
CAN_SetSpeed(CAN1, 250); // 250kb init
CAN_SetOperationMode(CAN1, MR_NORMAL); // can mode init
CAN1_INT_ENABLE.B4 = 1; // // CAN RX INTERRUPT Enable1
CAN_EnableInt(CAN1, CAN_RX_INT); // CAN RX INTERRUPT Enable
CAN_SetFilter(CAN1,0, 0x01);
void Timer() iv IVT_TIMERS_IRQ // 100ms timer interrupt
{
// ProcessVTFTStack();
// sen_val_dp();
// Clear Timer A interrupt flag
tm_cnt++;
if(tm_cnt==10)
{
msg.buf[0] = s_r_txflg;
CAN_PushMessage(CAN1,&msg);
tm_cnt = 0;
}
TIMER_INT.B0 = 1;
}
CAN bus data transfer inquiry
- darko.ilijevski
- Posts: 581
- Joined: 21 Mar 2017 16:57
Re: CAN bus data transfer inquiry
Hello,
From the code fragment you have pasted on your message, I can't see you have enabled interrupts for the timer : TIMER_INT.B1 = 1.
Also I don't see other registers regarding the timer module being set up, you have probably omitted that part of the code, but do check if your timer IRQs get triggered at all...
If you are using our compiler, there are CAN usage examples inside the FT90x compiler's 'Example' folder, you can use them as a reference for your own code. Also in the HELP of the compiler, you can find a lot of useful info on CAN functions and how to use them properly...
Best regards
From the code fragment you have pasted on your message, I can't see you have enabled interrupts for the timer : TIMER_INT.B1 = 1.
Also I don't see other registers regarding the timer module being set up, you have probably omitted that part of the code, but do check if your timer IRQs get triggered at all...
If you are using our compiler, there are CAN usage examples inside the FT90x compiler's 'Example' folder, you can use them as a reference for your own code. Also in the HELP of the compiler, you can find a lot of useful info on CAN functions and how to use them properly...
Best regards
BR,
Darko
Darko
Re: CAN bus data transfer inquiry
The timer interrupt will work without problems.
I initial timer code is not attached.
because The timer has been thought that there is no problem.
Attach timer code.
void timer0_init(void) // 10ms timer
{
TIMER_CONTROL_0 = 2;
TIMER_SELECT = 0;
TIMER_PRESC_LS = 36;
TIMER_PRESC_MS = 244;
TIMER_WRITE_LS = 15;
TIMER_WRITE_MS = 0;
TIMER_CONTROL_3 = 0;
TIMER_CONTROL_4 |= 17;
TIMER_CONTROL_2 |= 16;
TIMER_INT |= 2;
TIMER_CONTROL_1 |= 1;
}
thankyou
I initial timer code is not attached.
because The timer has been thought that there is no problem.
Attach timer code.
void timer0_init(void) // 10ms timer
{
TIMER_CONTROL_0 = 2;
TIMER_SELECT = 0;
TIMER_PRESC_LS = 36;
TIMER_PRESC_MS = 244;
TIMER_WRITE_LS = 15;
TIMER_WRITE_MS = 0;
TIMER_CONTROL_3 = 0;
TIMER_CONTROL_4 |= 17;
TIMER_CONTROL_2 |= 16;
TIMER_INT |= 2;
TIMER_CONTROL_1 |= 1;
}
thankyou
- darko.ilijevski
- Posts: 581
- Joined: 21 Mar 2017 16:57
Re: CAN bus data transfer inquiry
Hello,
Errors should be handled in routines, you need to check for an error and if it arises, you should handle it properly. Other than that - how many devices are there ? If only 2, you should have a terminating resistor at the other end to close the CAN loop. Do you have one in your circuit ?
Regards
Errors should be handled in routines, you need to check for an error and if it arises, you should handle it properly. Other than that - how many devices are there ? If only 2, you should have a terminating resistor at the other end to close the CAN loop. Do you have one in your circuit ?
Regards
BR,
Darko
Darko