STM32 program ATMega
You can use SPI to perform ISP on a AVR MCU. The exact steps and connections required are detailed in the "Memory Programming" section, "Serial Downloading" subsection of the '328 datasheet as well as in AVR910. I recommend that you implement a known protocol such as that described in AVR109 so that your programmer works with existing tools.