1
NXPTM M522XX, KINETIS and i.MX RT / Re: Porting Code to M5229
« on: September 29, 2009, 07:18:09 PM »
Mark I have read that one and the other threads of Neil. This is what I do:
I tried a lot of different combinations, negated RTS, changed count_delay, (for SP485)connected only RTS to RE*, connected both RTS to RE* and CTS to DE, connected CTS to ground, connected RTS to RE* and DE, used
What can I do now, or maybe Neil can share some thoughts/experience with us?
Best regards...
Code: [Select]
void PP_OpenComm(void)
{
TTYTABLE tInterfaceParameters; // table for passing information to driver
tInterfaceParameters.Channel = 0x02; // set UART channel for serial use
tInterfaceParameters.ucSpeed = SERIAL_BAUD_9600; // baud rate
tInterfaceParameters.Rx_tx_sizes.RxQueueSize = RX_BUFFER_SIZE; // input buffer size
tInterfaceParameters.Rx_tx_sizes.TxQueueSize = TX_BUFFER_SIZE; // output buffer size
tInterfaceParameters.Task_to_wake = TASK_PP_RECEIVE; // wake self when messages have been received
#ifdef SUPPORT_FLOW_HIGH_LOW
tInterfaceParameters.ucFlowHighWater = 80;// set the flow control high and low water levels in %
tInterfaceParameters.ucFlowLowWater = 20;
#endif
tInterfaceParameters.Config = (CHAR_8 + NO_PARITY + ONE_STOP + CHAR_MODE + RTS_CTS);
tInterfaceParameters.Config |= INFORM_ON_FRAME_TRANSMISSION;
#ifdef TEST_MSG_MODE
tInterfaceParameters.usConfig |= (MSG_MODE);
#if defined (TEST_MSG_CNT_MODE) && defined (SUPPORT_MSG_CNT)
tInterfaceParameters.usConfig |= (MSG_MODE_RX_CNT);
#endif
tInterfaceParameters.usConfig &= ~USE_XON_OFF;
tInterfaceParameters.ucMessageTerminator = '\r';
#endif
//#undef SERIAL_SUPPORT_DMA
#ifdef SERIAL_SUPPORT_DMA
tInterfaceParameters.ucDMAConfig = UART_TX_DMA; // activate DMA on transmission
#endif
if ((SerialPortID = fnOpen( TYPE_TTY, FOR_I_O, &tInterfaceParameters )) != 0) { // open or change the channel with defined configurations (initially inactive)
fnDriver( SerialPortID, ( TX_ON | RX_ON ), 0 ); // enable rx and tx
fnDriver( SerialPortID, (MODIFY_CONTROL | CONFIG_RTS_PIN), 0 );
fnDriver( SerialPortID, (MODIFY_CONTROL | CLEAR_RTS), 0 );
}
}
void fnTimer_0(void);
static DMA_TIMER_SETUP timer_setup_RTS_negate;
void fnTimer_0(void)
{
TOGGLE_APP_LED_THIRD();
fnDriver(SerialPortID, (MODIFY_CONTROL | CLEAR_RTS), 0);
}
extern void fnUARTFrameTermination(QUEUE_HANDLE Channel)
{
if (Channel == 2) {
timer_setup_RTS_negate.int_type = DMA_TIMER_INTERRUPT;
timer_setup_RTS_negate.channel = 1;
timer_setup_RTS_negate.int_priority = DMA_TIMER1_INTERRUPT_PRIORITY;
timer_setup_RTS_negate.int_handler = fnTimer_0; // enter timer call-back
timer_setup_RTS_negate.mode = (DMA_TIMER_INTERNAL_CLOCK | DMA_TIMER_SINGLE_SHOT_INTERRUPT);
timer_setup_RTS_negate.count_delay = DMA_TIMER_US_DELAY(1,1, 620);
TOGGLE_APP_LED_SECOND();
fnConfigureInterrupt(&timer_setup_RTS_negate); // start delay to RTS negation
}
}
void PP_WriteComm(unsigned short int usSize, unsigned char *pucOut)
{
.
.
.
TOGGLE_APP_LED_FIRST();
fnDriver(SerialPortID, (MODIFY_CONTROL | SET_RTS), 0); // driver RTS ‘1’
fnWrite(SerialPortID, pucOut, usSize);
.
.
.
}
void fnTaskPPReceive(TTASKTABLE *ptrTaskTable)
{
.
.
.
}
I tried a lot of different combinations, negated RTS, changed count_delay, (for SP485)connected only RTS to RE*, connected both RTS to RE* and CTS to DE, connected CTS to ground, connected RTS to RE* and DE, used
Code: [Select]
fnDriver( PortID, (MODIFY_INTERRUPT | ENABLE_CTS_CHANGE), 0 );
, and many different combinations with no luck.What can I do now, or maybe Neil can share some thoughts/experience with us?
Best regards...