Other Parts Discussed in Thread: HALCOGEN
Hi,
I have a problem using multi-buffered mode on SCI-A/lin.
Basically, I want to generate an interrupt every n bytes in order to not overload the cpu too much.
I thought that with multi-buffered mode I can choose after how many bytes generate an interrupt RXDY but it seems not working.
Here is my code:
void sciInit(void) { /** - bring SCI1 out of reset */ sci->GCR0 = 0U; sci->GCR0 = 1U; /** - Disable all interrupts */ sci->CLEARINT = 0xFFFFFFFFU; sci->CLEARINTLVL = 0xFFFFFFFFU; /** - global control 1 */ sci->GCR1 = (uint32)((uint32)1U << 25U) /* enable transmit */ | (uint32)((uint32)1U << 24U) /* enable receive */ | (uint32)((uint32)1U << 5U) /* internal clock (device has no clock pin) */ | (uint32)((uint32)(1U-1U) << 4U) /* number of stop bits */ | (uint32)((uint32)0U << 3U) /* even parity, otherwise odd */ | (uint32)((uint32)0U << 2U) /* enable parity */ | (uint32)((uint32)1U << 1U) /* asynchronous timing mode */ | (uint32)((uint32)1U << 16U) /* LOOP BACK MODE enabled for test*/ | (uint32)((uint32)1U << 10U); /* multi buffered mode enabled */ /** - set baudrate */ sci->BRS = 650U; /* baudrate */ /** - transmission length */ sci->FORMAT = /*0x0700 |*/ (8U - 1U); /* length (8 characters of size 8, according to datasheet) */ /** - set SCI1 pins functional mode */ sci->PIO0 = (uint32)((uint32)1U << 2U) /* tx pin */ | (uint32)((uint32)1U << 1U); /* rx pin */ /** - set SCI1 pins default output value */ sci->PIO3 = (uint32)((uint32)0U << 2U) /* tx pin */ | (uint32)((uint32)0U << 1U); /* rx pin */ /** - set SCI1 pins output direction */ sci->PIO1 = (uint32)((uint32)0U << 2U) /* tx pin */ | (uint32)((uint32)0U << 1U); /* rx pin */ /** - set SCI1 pins open drain enable */ sci->PIO6 = (uint32)((uint32)0U << 2U) /* tx pin */ | (uint32)((uint32)0U << 1U); /* rx pin */ /** - set SCI1 pins pullup/pulldown enable */ sci->PIO7 = (uint32)((uint32)0U << 2U) /* tx pin */ | (uint32)((uint32)0U << 1U); /* rx pin */ /** - set SCI1 pins pullup/pulldown select */ sci->PIO8 = (uint32)((uint32)1U << 2U) /* tx pin */ | (uint32)((uint32)1U << 1U); /* rx pin */ /** - set interrupt level */ sci->SETINTLVL = (uint32)((uint32)0U << 26U) /* Framing error */ | (uint32)((uint32)0U << 25U) /* Overrun error */ | (uint32)((uint32)0U << 24U) /* Parity error */ | (uint32)((uint32)0U << 9U) /* Receive */ | (uint32)((uint32)0U << 8U) /* Transmit */ | (uint32)((uint32)0U << 1U) /* Wakeup */ | (uint32)((uint32)0U << 0U); /* Break detect */ /** - set interrupt enable */ sci->SETINT = (uint32)((uint32)0U << 26U) /* Framing error */ | (uint32)((uint32)0U << 25U) /* Overrun error */ | (uint32)((uint32)0U << 24U) /* Parity error */ | (uint32)((uint32)1U << 9U) /* Receive interrupt*/ | (uint32)((uint32)0U << 1U) /* Wakeup */ | (uint32)((uint32)0U << 0U); /* Break detect */ /** - Finaly start SCI1 */ sci->GCR1 |= 0x80U; }
To test the peripheral I just send a bunch of dummy bytes and check if ISR is executed (since I'm working in loopback).
Without multi-buffer I can have an interrupt every byte sent and it's working fine, so the interrupts are well configurated but with multi-buffered mode ISR is never executed (I though ISR was executed every 8 bytes trasmitted).
Is it possible to generate an interrupt after n bytes without using DMA? If yes, how to get data? SCIRD register is only 1byte-length and I'm not understanding where the data will be available.
Thanks,
Marco.