Ok,
by following the advice of jens8051: RCC_PLLMul_6 instead of 9 to get the right clock with 12Mhz.
and by turning GPIO_Pin_12 to an output,
and reverting the original state in Audio_speaker like this:
void USB_Cable_Config (FunctionalState NewState)
{
if (NewState != DISABLE)
{ GPIO_SetBits(GPIOB, GPIO_Pin_12); // was ResetBits
}
else
{ GPIO_ResetBits(GPIOB, GPIO_Pin_12); // was SetBits
}
}
i was able to port the Audio_speaker USB examlpe to the Primer.
It runs perfectly well with no need to disconect the cable. (WindowsXP)
If you try this, you will also need to change the timer used for PWM to one wich is on the extension conector
i used Timer3 CH2 on PA7 with a simple RC filter to output audio.