How to write a driver for sc16is752 - i2c dual uart

Hi There

I didn't realise when chosing the nrf9160 that the peripherals were all shared, to a maximum of 4 serial type devices, (any combo of i2c, spi or uart to a max of 4 devices) 

I've used all the devices and need an additional serial port. I have a sc16is752 on the board, i2c -> dual uart expander. I'm struggling on how to get started to integrate this into zephyr as a driver so that I can use it as a normal serial port within zephyr. 

Are there any pointers that could be useful, I'm more than happy to contribute it back to the community when its done. 

Thanks 

Marshall

Parents
  • Hello,

    Please check out the following github repo (with example project and video for adding a sensor):
    https://github.com/teslabs/zds-2022-drivers-app 

    In your case you will need add a bindings/serial instead of bindings/sensor (and drivers/serial instead of drivers/sensor etc), but conseptually it should be the same. In addition to study the example on github you can also look for instance at how usb, rtt or uart have implemented serial in the corresponding folders.

    Best regards,
    Kenneth

  • Thanks, after a lot of effort, I've written it. it can now be used as a serial port in zephyr, complete with interrupts and callbacks etc. 

    I used the "uart_ns16550.c" as an example as this has almost the same register mapping. 

    If anyone wants to finish it off and add into the zephyr mainline I'm more than happy to share it. 

    I'm not experienced in submitting pull requests to Zephyr, and don't have the resources to make it match any submission criteria. 

    I'd be keen to see how the second serial port is implemented (I've done most of it) 

    Regards

    Marshall

Reply
  • Thanks, after a lot of effort, I've written it. it can now be used as a serial port in zephyr, complete with interrupts and callbacks etc. 

    I used the "uart_ns16550.c" as an example as this has almost the same register mapping. 

    If anyone wants to finish it off and add into the zephyr mainline I'm more than happy to share it. 

    I'm not experienced in submitting pull requests to Zephyr, and don't have the resources to make it match any submission criteria. 

    I'd be keen to see how the second serial port is implemented (I've done most of it) 

    Regards

    Marshall

Children
Related