Other Parts Discussed in Thread: HALCOGEN
I am trying to setup SCI3 to be able to receive a packet of data (waiting on an 0x0A) but I am only getting one sciNotification fired.
I have read information on other threads on the forum and am following the advise but I can't get my code to work.
Can someone help please?
Using HALCoGen I have setup the following:
- Enabled SCI3 Driver
- Enabled VIM Channel 64: SCI3 High
- SCI3 Global:
- TX INT
- RX INT
- SCI3 Data Format
- 115200 Baud Rate
- 1 Stop Bit
- 8 Data Bits
- No Parity Enable
- No Even Parity
- SCI3 Port
- TX, RX pins in Functional Mode
My code is as follows:
#include <string.h>
#include "HL_sys_common.h"
#include "HL_sys_core.h"
#include "HL_sci.h"
uint8 rx_idx;
uint8 rx_buf[ 32 ];
uint8 tx_buf[ 32 ];
int main(void)
{
uint8 ch;
memset( &rx_buf, 0x00, sizeof( rx_buf ) );
rx_idx = 0;
memset( &tx_buf, 0xAA, sizeof( tx_buf ) - 1 );
tx_buf[ sizeof( tx_buf ) - 1 ] = 0x0A;
sciInit();
_enable_interrupt_();
sciEnableNotification( sciREG3, SCI_RX_INT );
sciEnableLoopback( sciREG3, Digital_Lbk );
sciReceive( sciREG3, 1, ( uint8 * ) &ch );
sciSend( sciREG3, 32, ( uint8 * ) &tx_buf[ 0 ] );
while ( 1 );
return 0;
}
void sciNotification( sciBASE_t *sci, uint32 flags )
{
uint8 ch;
sciReceive( sci, 1, ( uint8 * ) &ch );
if ( ch == 0x0A )
{
rx_idx = 0;
}
else
{
/* Store character in corresponding SCI Rx Buffer and post increment array index */
rx_buf[ rx_idx ]= ch;
rx_idx++;
}
}
I have attached the HALCoGen project: