Other Parts Discussed in Thread: MSP430FR6989
I am using TI-RTOS on a MSP430FR6989, running at 8MHz MCK and ACK at 9400 Hz using the VLO.
I need to communicate with a Atmel ATSHA204A chip using only 1 wire.
I follow the datasheet of the chip. timing is crucial. I must be able to do short pulses of 4-6 microsecs during transmission to send zeros and ones.
For example:
One is line low for 6 usec , then line high until next bit (bit period is 54 usec)
Zero is line low for 6 usec, line high for 6 usec, line low for 6 usec then line high until next bit.
After a while I could manage to send the correct stream of bits to the chip, and the chip responds.
Then comes the receiver part: I need to decode the data coming from the chip.
I tried in different ways, using a timer and capture/compare, and using directly the line input interrupt.
When the chip replies, it sends for example 10 bytes. It is 80 sequences of 0/1 symbol. During the chip transmission, my ISR should be extremely quick in doing the following steps for each bit:
- detect the first line low
- wait 6 usec
- check the input line and decide the bit value (0 if line is low, 1 if line is high)
My problem is that I some bits. i investigate with an oscilloscope and I could find the reason. The RTOS clock tick.
With a clock tick period of 1000 us I miss some bits, with a period of 10000 us everything is OK. but of course for my application 10000us of clock tick is not acceptable.
Any idea on what to try next? Is there a way to disable/slow down the RTOS clock ticks just for the time when I am receiving data from the chip?
Any idea is appreciated. Thank you.
Claudio.
PS
To try to solve the problem I did the tests on a minimal project where only 1 task is running and no HWIs are enabled. only the system clock is active with no SWIs.
I could not use HWIs for my ISR since the latency was too high and I could not catch the signal value after 6 us.
I do not call any RTOS api from the ISR.
The task sends data to the chip then goes suspended on a semaphore with timeout (this cause the ticks to run), then check for the received data. (I may try also a task_sleep). I do not know yet how exactly synchronize with the receiving ISR since I cannot use RTOS APIs in it)