This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF52 Interfacing sensor with serial through UART

I have a sensor with serial protocol of 7 bits data, even parity, 2 stop bits. I wanted to use uart library to interface with this sensor. But I couldn't find the settings to change data bits, even/odd parity or number of stop bits. Is it possible to do so with uart library? Or I have to write functions by myself to read bit by bit? Thanks

Parents
  • No. If you check the UART specs you'll see it only supports 8 bit with one parity bit (or none). I believe that's even parity but I can't see where it says so. The old nRF51 series let you supply your own parity bit, which might have helped you on writes, but the nRF52 doesn't and it wouldn't help you on reads anyway.

    So you'll have to do it another way.

  • can't really say what it's likely to be at this point. Bitbanging the UART just isn't going to be that reliable, unfortunately. I don't understand your last question, you're reading the data, you can determine whether or not to send it or discard it, that has nothing to do with the softdevice.

    I looked to see if there were any cheap SPI/I2C --> UART bridge chips, because honestly you'd be better off doing that, however they were all more expensive than I would have expected.

    Your last option might be to go find the timeslot api which gives you a slot of time you get FULL control of everything. Use that to do your reading at a much higher baudrate (if your data providing chip supports that). Or find a different chip to interface with which uses a supported UART format or a different transport.

Reply
  • can't really say what it's likely to be at this point. Bitbanging the UART just isn't going to be that reliable, unfortunately. I don't understand your last question, you're reading the data, you can determine whether or not to send it or discard it, that has nothing to do with the softdevice.

    I looked to see if there were any cheap SPI/I2C --> UART bridge chips, because honestly you'd be better off doing that, however they were all more expensive than I would have expected.

    Your last option might be to go find the timeslot api which gives you a slot of time you get FULL control of everything. Use that to do your reading at a much higher baudrate (if your data providing chip supports that). Or find a different chip to interface with which uses a supported UART format or a different transport.

Children
No Data
Related