hi sir,
i am using the TMS470MF06607 microcontroller , in the TMS470MHDK .
previously i did the DCAN transmit and receive functions with interrupt handler, using different baudrates.
i did 500kbps , 100kbps, 83kbps , 33kbps. previously its working good.
i am using the interrupt for both transmission and reception. i am using my TMS470MHDK board one end & saint tool for another end.(tranmit and receive).
in DCAN1 i am usiing message object 1 for tx , and message object 2 for receive .
in DCAN2 i am using the message object 3 for tx, and message object 4 for receive.
but now i am facing one problem . in my code i receive the uart data . based upon the uart data i tried to transmit the data from DCAN2 to saint tool, its transmitted at the first time, but its not moving to the next step . (for transmit ,i am using the example code given in the HELCOGEN. )
after complete the CAN transmit function my code stoped in the while loop, its not go the interrupt handler. its keep on stop in that loop only.
i dont know where my code get blocked . but previously its work properly. ( can i use my CANTRANSMIT() , in side of the uart interrupt handler ) .
can you please anyone tell me the solution for this problem . i attached part of my code in the down side.
hint : (after uart receive every data, this function is called)
program:
void uart_data_check(uint8 *SCI1_Buffer,int SCI1_Index)
{
uint8 temp_size=0, i=0, crc_index=0 , data_index=3;
int z=0;
if(SCI1_Tx_Flag == 1)
{
//if((SCI1_Buffer[0] == 0xA5) && (SCI1_Buffer[1] == 0x5A) && (SCI1_Buffer[SCI1_Index-2] == 0x5A) && (SCI1_Buffer[SCI1_Index-1] == 0xA5))
if((SCI1_Buffer[0] == 0xA5) && (SCI1_Buffer[1] == 0x5A))
{
temp_size = SCI1_Buffer[2];
for(i=0 ; i<temp_size ; i++)
{
uart_data_buffer[i] = SCI1_Buffer[i+3];
}
uart_data_crc = crc_calculation(uart_data_buffer, temp_size);
crc_index = (temp_size + 3);
if(uart_data_crc == SCI1_Buffer[crc_index])
{
if((uart_data_buffer[0] == 'S') && (uart_data_buffer[1] =='T'))
{
uart_make_frame(connect_ack,2);
}
if((uart_data_buffer[0] == 'S') && (uart_data_buffer[1] =='W') && (uart_data_buffer[2] =='C'))
{
can_83kbps();
canEnableErrorNotification(canREG2);
uart_make_frame(sw_config_ack,5);
}
if((uart_data_buffer[0] == 'F') && (uart_data_buffer[1] =='T') && (uart_data_buffer[2] =='C'))
{
can_100kbps();
canEnableErrorNotification(canREG1);
uart_make_frame(ft_config_ack,5);
}
if((uart_data_buffer[0] == 'S') && (uart_data_buffer[1] =='W') && (uart_data_buffer[2] == 'D'))
{
for(z=0; z<(temp_size-3); z++)
{
sw_tx_data[z] = uart_data_buffer[data_index++];
}
canTransmit(canREG2, canMESSAGE_BOX3, sw_tx_data);
while(sw_tx_done == 0){}; // my code keep on stuck here only. its not move to the interrupt handler.
sw_tx_done = 0;
}
if((uart_data_buffer[0] == 'F') && (uart_data_buffer[1] =='T') && (uart_data_buffer[2] == 'D'))
{
for(z=0; z<(temp_size-3); z++)
{
ft_tx_data[z] = uart_data_buffer[data_index++];
}
canTransmit(canREG1, canMESSAGE_BOX1, ft_tx_data);
while(ft_tx_done == 0){}; // / my code keep on stuck here only. its not move to the interrupt handler.
ft_tx_done=0;
}
}
}
else
{
sciSend(sciREG1, 18, frame_formate_ack);
}
}
memset(uart_data_buffer, 0, sizeof(uart_data_buffer)); // clear the uart data buffer, otherwise the previous data is there only. crc calculation get affected
SCI1_To_SCI2_Tx();
}
regards
Arun kumar.N