Search found 29 matches

by nmz787
Wed May 30, 2018 7:21 pm
Forum: Development of MicroPython
Topic: in C, how do I perform equivalent of stm.mem32[x]= y ?
Replies: 5
Views: 4079

Re: in C, how do I perform equivalent of stm.mem32[x]= y ?

If you grep for mem16 you'll see it is part of the stm module as defined in modstm.c where it says { MP_ROM_QSTR(MP_QSTR_mem16), MP_ROM_PTR(&machine_mem16_obj) }, The MP_QSTR_ prefix is an implementation detail because strings are interned in MicroPython, important part is it tells you stm.mem16 re...
by nmz787
Wed May 30, 2018 8:57 am
Forum: Programs, Libraries and Tools
Topic: PyCharm MicroPython pyb module?
Replies: 3
Views: 6064

Re: PyCharm MicroPython pyb module?

I had to mock a few other files too, to get my code to import without error, and helped me sort out weird errors that MicroPython wasn't raising exceptions for (I think the last had to do with fancy/non-standard quotation characters that somehow made it into my code file after pasting in comments fr...
by nmz787
Wed May 30, 2018 8:48 am
Forum: Development of MicroPython
Topic: in C, how do I perform equivalent of stm.mem32[x]= y ?
Replies: 5
Views: 4079

in C, how do I perform equivalent of stm.mem32[x]= y ?

I am trying to write a very tight loop in C, based on the adc.c read_timed method... it might end up turning into a PI or PID control loop to control the width or period of two timer PWM channels. In Python I was calling this sort of function to adjust the PWM/Timer period and width: def adjust_tim2...
by nmz787
Wed Nov 01, 2017 3:34 pm
Forum: MicroPython pyboard
Topic: Read ADC using DMA
Replies: 20
Views: 26027

Re: Read ADC using DMA

ADC with DMA hack OK, I finally got around to hacking adc.c to use DMA to read the ADC. As above we'll do 10,000 samples. >>> import pyb >>> import array >>> adc = pyb.ADC('X1') >>> buf = array.array('H', bytearray(20000)) >>> t1=pyb.micros(); n=adc.read_timed(buf,2000000); t2=pyb.micros() >>> t2-t...
by nmz787
Mon Oct 30, 2017 10:27 am
Forum: WiPy and CC3200 boards
Topic: Scripting testing with pexpect
Replies: 2
Views: 10893

Re: Scripting testing with pexpect

Thanks! I just used this along with a Python TK example for line plots... here's the result if anyone is interested (code is subject to being moved, as we cleanup the repo in the future... it should be findable in the commit history in the far-future anyway): https://github.com/nmz787/culture_shock/...
by nmz787
Wed Mar 22, 2017 8:49 am
Forum: Other Boards
Topic: How can I increase the callback priority/importance on my Timer? (STM32F401)
Replies: 12
Views: 10836

Re: How can I increase the callback priority/importance on my Timer? (STM32F401)

another odd issue with that code, is that the board locks up if I try to set the default period to something small, like 100 This is odd especially because if I start the board with higher period and width settings, then adjust things later, with the adjust_tim1 function, it works to decrease thing...
by nmz787
Wed Mar 22, 2017 8:35 am
Forum: Other Boards
Topic: How can I increase the callback priority/importance on my Timer? (STM32F401)
Replies: 12
Views: 10836

Re: How can I increase the callback priority/importance on my Timer? (STM32F401)

I modified nvic.py to add the nvic_set_prio function. The dump_nvic routine doesn't print 0 entries, so any entry that doesn't show up can be assumed to be zero. You can see that the SysTick_IRQn (-1) now has a priority of 1, and TIM1_UP_TIM10_IRQn (25) doesn't show up any more which means it has a...
by nmz787
Wed Mar 22, 2017 8:31 am
Forum: Other Boards
Topic: How can I increase the callback priority/importance on my Timer? (STM32F401)
Replies: 12
Views: 10836

Re: How can I increase the callback priority/importance on my Timer? (STM32F401)

NVIC and SysTick are common to all Cortex-M processors. STM has document PM0214: http://www.st.com/resource/en/programming_manual/dm00046982.pdf which covers off the STM32F3 and STM32F4 series. This document includes the NVIC, SysTick, the instruction set and registers. Ah, ok, thanks! More to read...
by nmz787
Wed Mar 22, 2017 5:02 am
Forum: Other Boards
Topic: How can I increase the callback priority/importance on my Timer? (STM32F401)
Replies: 12
Views: 10836

Re: How can I increase the callback priority/importance on my Timer? (STM32F401)

I couldn't see the SysTick interrupt at level 0 in my output: NVIC_PRIO = 00000000 @ e000e400 VTOR = 08000000 @ e000ed08 System IRQs -2:15 Regular IRQs 4:2 25:14 27:14 50:6 67:6 and my board didn't like when I tried setting the callback function's priority to 0. It did however seem to be OK with bei...