- This topic has 0 replies, 1 voice, and was last updated 1 month, 2 weeks ago by
Logan Moon.
-
AuthorPosts
-
February 6, 2025 at 10:33 pm #16839
(This message was transferred over from our old forum)
Posted August 19, 2015
By Todd DeBoer
[hr]
On 6/6/12 Jaybee asked, “Is the half duplex HAL driver written, or do we just use the LPC1788_UARTx_Require() routine written in serial.c? Or we have to write a new HAL for it?”
[hr]
(Follow up post)Answered:
Half duplex drivers are currently done in the device drivers and not at the HAL layer (currently).
There is a RS232/TTL version of the half duplex drivers here:
/uEZ/Source/Devices/Serial/Generic/uEZSerialGenericHalfDuplex.cThe RS485 driver has two different versions of controlling drive enable / receive enable here:
/uEZ/Source/Devices/RS485/Generic/Generic_RS485.c, and
/uEZ/Source/Devices/RS485/Generic/Generic_RS485_Timer.cThe Timer version controls the timing of the drive/release timing with a hardware timer instead of larger millisecond timing intervals.
A bug has been identified in all these drivers where “if (p->iDriveEnablePort)” should be “if (p->iDriveEnablePolarity)” in 3 places (per driver file). A bug fix is planned for uEZ v2.01 release by the end of the month.
Many of the platform files don’t have anything for half-duplex more than the following function:
void UEZPlatform_Console_HalfDuplex_UART_Require(
const char *aHALSerialName,
TUInt32 aWriteBufferSize,
TUInt32 aReadBufferSize,
T_uezGPIOPortPin aDriveEnablePortPin,
TBool aDriveEnablePolarity,
TUInt32 aDriveEnableReleaseTime)If you find you need another serial port with half duplex, you can add to your main.c a function in the similar format:
void UEZPlatform_UART2_HalfDuplex_Require(
const char *aHALSerialName,
TUInt32 aWriteBufferSize,
TUInt32 aReadBufferSize,
T_uezGPIOPortPin aDriveEnablePortPin,
TBool aDriveEnablePolarity,
TUInt32 aDriveEnableReleaseTime)
{
DEVICE_CREATE_ONCE();
LPC1788_UART2_Require();
// NOTE: This require routine does NOT require the GPIO driver
// needed for the GPIO drive enable port pin!
Serial_Generic_HalfDuplex_Stream_Create(“UART2”, “UART2”,
aWriteBufferSize, aReadBufferSize, aDriveEnablePortPin,
aDriveEnablePolarity, aDriveEnableReleaseTime);
} -
AuthorPosts
- You must be logged in to reply to this topic.