Search found 11 matches

by ul5255
Sun Feb 22, 2015 4:12 pm
Forum: Development of MicroPython
Topic: Request for Comments: DAC Interface
Replies: 13
Views: 15695

Spectra/Bug

I went ahead and measured the DAC output spectrum of the unmodified MicroPython firmware. Setup is a Steinberg UR22 on the PyBoard pin X6, software is AudioMeter v. 3.6.1. I generated a 1kHz sine wave with the code from my previous post. The screenshot shows the output spectrum with lots of harmonic...
by ul5255
Thu Feb 19, 2015 3:07 pm
Forum: Development of MicroPython
Topic: Request for Comments: DAC Interface
Replies: 13
Views: 15695

Back to the Drawing Board ...

well, I reflashed the original firmware from 18-FEB-2015 and ran this code: # place jumper between X6 and X19 import array import math a = pyb.ADC(pyb.Pin.board.X19) d = pyb.DAC(2) # sine wave output buffer #b = array.array('H', [0]*100) b = bytearray(100) for i in range(len(b)): # b[i] = 2048 + int...
by ul5255
Thu Feb 19, 2015 2:25 pm
Forum: Development of MicroPython
Topic: Request for Comments: DAC Interface
Replies: 13
Views: 15695

DAC.write_timed() w/ 12 bit resolution

I *think* I have a working version of DAC.write_timed() which supports 12 bit resolution (currently hard-coded). So I set out to test it: # place jumper between X6 and X19 import array import math a = pyb.ADC(pyb.Pin.board.X19) d = pyb.DAC(2) # sine wave output buffer b = array.array('H', [0]*100) f...
by ul5255
Thu Feb 19, 2015 12:17 pm
Forum: Development of MicroPython
Topic: Request for Comments: DAC Interface
Replies: 13
Views: 15695

Re: Request for Comments: DAC Interface

I can confirm that the bit masking is not necessary. The final version in dac.c is HAL_DAC_SetValue(&DAC_Handle, self->dac_channel, DAC_ALIGN_12B_R, mp_obj_get_int(val)); It can be tested with this sequence: # place jumper between X6 and X19 a = pyb.ADC(pyb.Pin.board.X19) d = pyb.DAC(2) d.write(0) a...
by ul5255
Thu Feb 19, 2015 11:03 am
Forum: Development of MicroPython
Topic: Request for Comments: DAC Interface
Replies: 13
Views: 15695

DAC.write w/ 12bit resolution is working

so as a first test I changed the implementation of DAC.write in dac.c from: HAL_DAC_SetValue(&DAC_Handle, self->dac_channel, DAC_ALIGN_8B_R, mp_obj_get_int(val)); to HAL_DAC_SetValue(&DAC_Handle, self->dac_channel, DAC_ALIGN_12B_R, mp_obj_get_int(val)&0xFFF); After I uploaded the new firmware to the...
by ul5255
Thu Feb 19, 2015 8:34 am
Forum: Development of MicroPython
Topic: Request for Comments: DAC Interface
Replies: 13
Views: 15695

Re: Request for Comments: DAC Interface

I have the cross compiler working and can build MicroPython for the PyBoardV10, just need to test how to upload to the board with the DFU utility. I will first make some changes to hardcode usage of 12bit values in write and write_timed. As for alignment I already checked a little bit yesterday and ...
by ul5255
Wed Feb 18, 2015 10:34 am
Forum: Development of MicroPython
Topic: Request for Comments: DAC Interface
Replies: 13
Views: 15695

Re: Request for Comments: DAC Interface

taking it in small steps: Step 1 is to set up a cross compiler tool chain and test it by introducing a DAC.writeHighRes(...) method which accepts 12bit wide values. Would this be just a copy of the code of DAC.write with the only change in this line from DAC_ALIGN_8B_R to DAC_ALIGN_12B_R? Or more ge...
by ul5255
Thu Feb 12, 2015 10:29 pm
Forum: General Discussion and Questions
Topic: Digital filter and assembler code examples
Replies: 17
Views: 17181

Re: Digital filter and assembler code examples

Peter,
where does this data() instruction in our inline assembler come from? I haven't seen this being mentioned anywhere in the official docs or the Wiki.
by ul5255
Thu Feb 12, 2015 10:04 pm
Forum: Development of MicroPython
Topic: Request for Comments: DAC Interface
Replies: 13
Views: 15695

Re: Request for Comments: DAC Interface

Hi Bryan, After thinking about this for a while I want to see how far I can push this proof of concept with just Python and inline assembler. I dont feel like setting up a cross compiler to hack on the C code base ;) . With stm.mem32 and friends there should be enough foundation for these experiment...
by ul5255
Thu Feb 12, 2015 2:48 pm
Forum: Development of MicroPython
Topic: Request for Comments: DAC Interface
Replies: 13
Views: 15695

Request for Comments: DAC Interface

Dear MicroPythonista, I hope this post belongs here, if not feel free to move it to a more appropriate place. I did notice that the MicroPython documentation for the DAC class states that the interface is subject to change so this is my contribution to a (possibly already ongoing) discussion about t...