I am using a custom board using 28027F. I am using Motorware Lab 20 for my project. The board uses RS-485 for SCI communications. The isolator's transmit and received enable pins are shorted. I have set up the communications but I need to toggle the enable pins so as to receive and transmit. I can set the GPIO12 high and low to transmit however it does not toggle. If it is set high (or low) at the beginning (in hal.c) file it retains that value throughout the program. I want to keep it low so that I will always receive communication, set it high only when I am going to transmit. This is the short code I wrote to test it:
In main.c
ReceivedChar = HAL_sciaRead(halHandle);// & 0x00FF;
if(receiveflag==1)
{
//HAL_pieAckInt(halHandle,PIE_GroupNumber_9); // Issue PIE ack INT9
GPIO_setHigh(gpioHandle, GPIO_Number_12);
HAL_sciaWrite(halHandle, 5);
GPIO_setLow(gpioHandle, GPIO_Number_12);
//receiveflag = 0;
}
in hal.c in setupGpio function
// RS-485
GPIO_setMode(obj->gpioHandle,GPIO_Number_12,GPIO_12_Mode_GeneralPurpose);
GPIO_setDirection(obj->gpioHandle,GPIO_Number_12,GPIO_Direction_Output);
GPIO_setLow(obj->gpioHandle, GPIO_Number_12);
...
The pin seems to remain low instead of going high in the if loop.