0

i have 8 external DACs MCP4728 which i'm communicating with using i2c. The data is coming directly from a USB cable (16-17ms) and i need to update/write those values as soon as i can. Right now i'm writing to the i2c inside the USB callback function.

Normally i see code (not DAC related) where a flag is set and then in the main loop, since the flag to update is true, something is perfomed (in this case the DACs should be set).

Can the implementation be the source of those spikes (which tipically are present only with high frequency values) ? Can bit-skew be the problem with 17ms of updating time ?

Luigi
  • 376
  • 3
  • 16
  • SO does not generally entertain opinion-based questions. What is "good?" – lit Apr 13 '17 at 10:23
  • proper? state of the art? correct? – Luigi Apr 13 '17 at 10:31
  • See item 4. http://stackoverflow.com/help/on-topic – lit Apr 13 '17 at 10:36
  • Well we cannot see the implementation... – Bence Kaulics Apr 13 '17 at 11:51
  • Because USB is host driven and packet oriented the transmission is triggered in an specified interval. What you see is probably some crossover talking of the usb transmission lines to your dac channels and is pcb design related. – veeman Apr 14 '17 at 11:59
  • @veeman Mhmm that's a good way of viewing it... Do you think that it could change if i move the write call in the main loop and let the usb update a flag only? – Luigi Apr 14 '17 at 14:04
  • It is a common and recomended practice to process data outside from ISRs. But in i think in your case this will not really help you. – veeman Apr 17 '17 at 18:57
  • So do you think it is an HW related problem most likely? I will try different changes to see if the SW can help. – Luigi Apr 18 '17 at 10:05
  • Yes i think it is a HW related problem. I had a similar problem. I sampled several data source (ADC) and send it over USB. Every time a packet where transmitted i had some spikes in the values. To verfier if this is also happens to you, you can try the following things - Reduce clock speed for your I2C and other used peripherials - Disable USB entirely and use a free UART Port with reduces speed instead. – veeman Apr 20 '17 at 08:20

0 Answers0