Hi folks,
I am trying to get the SCI working on the F28027. I am working from some SCI code that I used on a previous project on the same device and was working there and also from the SCI echo back example project.
As in the echo back example I have enabled FIFOs and use polling of the Rx FIFO status to check when the FIFO has received data. However For every byte I send from the hyper terminal I receive two bytes (scope shows there is only the one expected byte sent on the line).
Neither of the bytes received seem to have any correlation to the ASCII data that is sent and the SCIRXST always reports a framing error. Having checked the values in all the SCI settings registers and compared them to the working echo back project I am at a loss as to why this should happen.
I am using the same UART settings in the Hyper terminal as with the echo back project
An example data scenario is: I type in the hyperterminal: "11111"
Then the data "received" by the SCI shows as: "8006 0087 8006 00F8 8006 00F8 8006 00F8 8006 0087"
My SCI code is as below:
// The baudRate is set to SCI_BaudRate_9_6_kBaud when called by main(), which has already set the low speed clock to 15MHz. int16_t SCI_CTRL_config(const SCI_CTRL_Handle sciCtrlHandle, const SCI_BaudRate_e baudRate) { int16_t e = EXIT_SUCCESS; CLK_enableGpioInputClock(clk); /* Enable clock to GPIO. */ CLK_enableSciaClock(clk); /* Enable clock to SCI-A. */ /* Configure GPIO lines for SCI-A port. */ GPIO_setDirection(sciCtrlHandle->gpio, GPIO_SCIRX_LINE_NUMBER, GPIO_Direction_Input); GPIO_setPullUp (sciCtrlHandle->gpio, GPIO_SCIRX_LINE_NUMBER, GPIO_PullUp_Enable); GPIO_setQualification(sciCtrlHandle->gpio, GPIO_Number_28, GPIO_Qual_ASync); GPIO_setMode (sciCtrlHandle->gpio, GPIO_SCIRX_LINE_NUMBER, GPIO_28_Mode_SCIRXDA); GPIO_setDirection(sciCtrlHandle->gpio, GPIO_SCITX_LINE_NUMBER, GPIO_Direction_Output); GPIO_setPullUp (sciCtrlHandle->gpio, GPIO_SCITX_LINE_NUMBER, GPIO_PullUp_Disable); GPIO_setMode (sciCtrlHandle->gpio, GPIO_SCITX_LINE_NUMBER, GPIO_29_Mode_SCITXDA); /* Configure SCI-A communication. */ SCI_setNumStopBits (sciCtrlHandle->sci, SCI_NumStopBits_One); SCI_disableParity (sciCtrlHandle->sci); SCI_disableLoopBack(sciCtrlHandle->sci); SCI_setMode (sciCtrlHandle->sci, SCI_Mode_IdleLine); SCI_setCharLength (sciCtrlHandle->sci, SCI_CharLength_8_Bits); /* Configure SCI-A control. */ SCI_disableRxErrorInt(sciCtrlHandle->sci); SCI_disableTxWake (sciCtrlHandle->sci); SCI_disableSleep (sciCtrlHandle->sci); SCI_enableTx (sciCtrlHandle->sci); SCI_enableRx (sciCtrlHandle->sci); SCI_setBaudRate(sciCtrlHandle->sci, (SCI_BaudRate_e)baudRate); SCI_enableRxInt(sciCtrlHandle->sci); SCI_enableTxInt(sciCtrlHandle->sci); /* Configure SCI-A RX fifo. */ SCI_enableFifoEnh (sciCtrlHandle->sci); SCI_resetTxFifo (sciCtrlHandle->sci); SCI_clearTxFifoInt (sciCtrlHandle->sci); SCI_resetChannels (sciCtrlHandle->sci); SCI_setTxFifoIntLevel(sciCtrlHandle->sci, SCI_FifoLevel_Empty); /* Configure SCI-A TX fifo. */ SCI_clearRxFifoOvf (sciCtrlHandle->sci); SCI_resetRxFifo (sciCtrlHandle->sci); SCI_clearRxFifoInt (sciCtrlHandle->sci); SCI_setRxFifoIntLevel(sciCtrlHandle->sci, SCI_FifoLevel_4_Words); SCI_enable(sciCtrlHandle->sci); return e; } // This is called from the super-loop at bottom of main(), which does nothing else. void SCI_CTRL_blockingReadAll(SCI_CTRL_Handle sciCtrlHandle) { while(SCI_getRxFifoStatus(sciCtrlHandle->sci) < SCI_FifoStatus_1_Word) { } trace = (trace << 8) | *((uint16_t *)0x7055); uint16_t d = SCI_getData(sciCtrlHandle->sci); QUE_enqueue(sciCtrlHandle->rxQue, &d, 1); }
The signal to the C28x on the scope looks perfect, straight edges, correct levels, correct timing, etc