Other Parts Discussed in Thread: CC2640
Dear colleagues,
I'm trying in CC2640 implement parity detecion(NACK signal) acc. ISO7816-3. Short introduction. When SIM card send character,where parity bit is corrupted,receiver(in this case MCU) must pull UART line to ground after time 10.5 bit from start of bit for 1-2 bit time. I developed this using sensor controller. I can achieve good baudrate(up 400kbits) . I'm polling state of bits and I calculate parity bit. I'm happy from this. But I have little problem with control of this Task. In Aplication I call:
scifOsalInit();
scifInit(&scifDriverSetup);
scifSwTriggerExecutionCodeNbl(BV(0));
For waiting start bit I used function fwWaitForEvSignal().Thanks for this I have constanty small latency. But big disadvantage is, that I have no possibility kill this task.And I have no full control, what sensor controller do.currently . When I want end of task, I 'm using special input variable presc. But I have to wait to next failing edge on the UART.
Do You know, how I can kill such task earlier? scifUninit?
In my case scifOsalInit() is needed? When I'm not using task scheduler.
My sensor controller code:
U16 stateRx = 0; U16 i = 0; U16 parity = 0; U16 work = 1; while(work == 1){ i = 0; parity = 0; fwWaitForEvSignal(FW_WAIT_SIGNAL_AUXIO_BASE+AUXIO_I_RX,0); timer0Start(TIMER0_MODE_SINGLE,input.NACKdelay-25,0); if(input.presc == 0){ timer1Start(TIMER1_MODE_SINGLE,input.delay-55,0); timer1Wait(); timer1Start(TIMER1_MODE_SINGLE,input.halfBitDelay,0); timer1Wait(); while(i<8){ gpioGetInputValue(AUXIO_I_RX;stateRx); parity ^= stateRx; timer1Start(TIMER1_MODE_SINGLE,input.delay-47,0); timer1Wait(); i = i+1; } //Parity bit gpioGetInputValue(AUXIO_I_RX;stateRx); parity ^= stateRx; output.NACK = 0; timer0Wait(); if(parity == 1){ gpioSetOutput(AUXIO_O_ERROR); timer1Start(TIMER1_MODE_SINGLE,input.delay-40,0); timer1Wait(); gpioClearOutput(AUXIO_O_ERROR); fwWaitForEvSignal(FW_WAIT_SIGNAL_AUXIO_BASE+AUXIO_I_RX,1); }else{ timer1Start(TIMER1_MODE_SINGLE,input.delay-47,0); timer1Wait(); gpioGetInputValue(AUXIO_I_RX;stateRx); if(stateRx == 0){ output.NACK = 1; } fwWaitForEvSignal(FW_WAIT_SIGNAL_AUXIO_BASE+AUXIO_I_RX,1); }else{ work = 0; } }