Author Topic: UART keep alive signal for SFP fiber  (Read 3247 times)

0 Members and 1 Guest are viewing this topic.

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8179
  • Country: fi
Re: UART keep alive signal for SFP fiber
« Reply #25 on: February 08, 2023, 06:03:02 pm »
i want a simple way of using sfp to transmit anything i want to from a microcontroller that can at the same time do other tasks.

This simple way is indeed to use UART or SPI peripheral to send/receive manchester encoded bits, and let an ISR handle encode/decode for every 32 bits or so (using UART in FIFO mode, SPI with any bit length in FIFO mode, or SPI in 32-bit mode, if available, without FIFO mode). This way you offload the CPU quite a bit, and processing a single 32-bit word at once is more efficient than working with 8-bit interrupts, or even worse, bit-by-bit interrupts. Yet processing every 32 bits does not incur that much latency (compared to batch processing large DMA buffers).

Rest of the application can run as usual, including interrupts. Wrap the whole thing in its own .c file and you can reuse it for many projects. If your application needs very low-latency interrupt processing for some certain things, which cannot wait for maybe 50 clock cycles of your encode/decode ISR, then just use higher interrupt priority for those things.
 

Offline dobsonr741

  • Frequent Contributor
  • **
  • Posts: 674
  • Country: us
Re: UART keep alive signal for SFP fiber
« Reply #26 on: February 08, 2023, 07:16:41 pm »
Amper, what FSK hardware are you thinking of?
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26907
  • Country: nl
    • NCT Developments
Re: UART keep alive signal for SFP fiber
« Reply #27 on: February 08, 2023, 09:23:40 pm »
@Amper: what other peripherals do you have in that microcontroller?
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf