Hi,
I am trying to figure out how serial handling works. Specific questions bolded below. To the best I can see, what I think happens when transmitting is:
- NRF_SERIAL_DRV_UART_CONFIG_DEF is called to configure the Tx & Rx pins. --after this configuration happens, do these pins become untouchable by everything except whatever is under the hood in the nordic serial library? ex: if I write separate code to set or clear the Tx or Rx pins does it not have any effect?
- NRF_SERIAL_BUFFERS_DEF and NRF_SERIAL_QUEUES_DEF create buffer and queue instances --The brief says, "Creates an instance of serial port buffers" (plural). If it is a single instance, how can it be multiple buffers and multiple queues?
- Based on this post, NRF_SERIAL_CONFIG_DEF is called to configure the port mode (Polling, IRQ, or DMA) & associate buffers, queues, and event handler.
- NRF_SERIAL_UART_DEF is called to create instance of serial port -- what exactly does this do?
- a buffer (typically 1 byte) is filled, then empties into a queue (as long as you want it to be). --how are buffers and queues are filled and emptied?
- When the queue gets full, something happens to cause it to transmit. --what causes transmission to occur? When transmission occurs, does the serial library append a start and stop bit? How & where does this happen? *
- When transmission is complete, an event is generated, which in turn generates an interrupt and passes the event to the serial event handler. --what specifically generates the event and interrupt / how does the system know that transmission is complete?
Please let me know if any of this is wrong, it probably is.
The only documentation I could find on serial handling is as follows, and doesn't explain the above questions:
1. Serial port library: infocenter.nordicsemi.com/index.jsp
How are these two things related?
I also found this Serial port library example documentation here, but it does not say what the example code folder is called or where it lives in the SDK. Can you please share this info?
* I have two goals:
1. Transmit a certain set of bytes over and over in a loop (because of gaps in knowledge above, I cannot figure out how to do this yet)
2. Upon every Tx, transmit 1.5 bytes (12 bits) of logic high before start bit is sent
(Suggestions for solving these are welcome!)
For #2, I saw this suggestion (Option 1) here to do it by timing it, but shouldn't I be able to handle this with the serial library? Or do you think if I use the serial library, I will have to modify the library directly?
Thank you so much!