This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Possible to bitbang a 9600baud UART on nRF51822?

Is it possible to bit bang a 9600 baud UART on the nRF51822 while the BLE softdevice is running?

The reciprocal of 9600 baud is around 100 µs, so the interrupt handler will need to run about that often for the UART to work reliably. However, the S110 SDS specifies that the processor could be taken up by the highest-priority soft device interrupt for up to 400-500 µs.

It seems to me that would prevent the bit-bang timer interrupt from running, and would cause bits to be lost. Is this correct?

I need to communicate with two different devices (so 2 UARTs) using a protocol with 2 stop bits, so I cannot use the chip's hardware UART

Parents
  • You can't bit bang it just by using interrupts, no, because indeed you'll be blocked randomly and will lose timing sync. At 9600baud however one character is just over 1ms, you could use the multiprotocol timeslot api to request a block of time and you get control over the hardware for that block. During that time you push out a number of complete characters, then ask for an extension or relinquish control and request another block and continue when you get more time allocated.

    As long as your data is 'bursty' you should be able to send it out without it backing up on you.

  • You can get a timeslot length of 100us, but you are not guaranteed to get this slot every 100us. I mean to say that timeslot length is not a problem, timeslot interval(periodicity) is. If the connection interval is slow like 100ms or so, then there can be 999 timeslots that can be allocated, but then the softdevice will reject any further request until it uses up its next 270us. If we are bitbanging flowcontrol and if the radio activity is very less (slow intervals), then MAYBE we can get close to that baudrate, does not seem impossible though

Reply
  • You can get a timeslot length of 100us, but you are not guaranteed to get this slot every 100us. I mean to say that timeslot length is not a problem, timeslot interval(periodicity) is. If the connection interval is slow like 100ms or so, then there can be 999 timeslots that can be allocated, but then the softdevice will reject any further request until it uses up its next 270us. If we are bitbanging flowcontrol and if the radio activity is very less (slow intervals), then MAYBE we can get close to that baudrate, does not seem impossible though

Children
No Data
Related