Gas station without pumps

2021 January 9

One week into new quarter

We’re one week into the new quarter (10% of the way through!) and the course is going ok. Most of the students have finished the first-week lab, which consists of installing a lot of software and soldering headers onto a Teensy LC board.

The software they had to install was

Of course, each piece of software has its own installation idiosyncracies, different on Windows, macos, and Linux.  Some people even bumped into some problems because of running old versions of macos or Python (which were luckily cleared by upgrading to slightly newer versions).

The soldering was a bigger problem, because many students plugged in their cheap irons and left them on for a long time without tinning the tips.  The result was a sufficient build-up of corrosion that that they could not then tin the tips—even using a copper ChoreBoy scrubber to clean the tips didn’t help in some cases. In the in-person labs, I often spent most of the first week labs cleaning soldering iron tips that students had managed to mess up, but I can’t do that online.  This was not such a problem last quarter, as most of the students knew how to care for soldering irons from the first half of the course, but it may be a bigger problem this quarter, as most of the students have never touched a soldering iron before.  Some of the ones who are living here in town may be contacting the lab staff to see if they can get access to tip tinner or get some help cleaning their irons.  Those further away may be buying tip tinner on their own—I had not included it in kits, because I nad not expected so many to need it and it costs $8 apiece.

Grading is going fairly well.  My grading team and I have had two Zoom meetings so far (for Homeworks 1 and 2) and I graded Quiz 1 by myself, so we are keeping up with the grading.  He have Homework 3 and Prelab 2a (there is no Prelab 1) both due Monday morning, and we’ll try getting them graded Monday night.  We’re having to do most of our grading in the evening, because one of the graders is living in China, 15 time zones away, and none of us in California is an early morning person.

In other news, I’ve finally finished clearing the blackberries and ivy from behind the garage (a project I started about 2 years ago).  I’ll probably find some more when I cut back the kiwi vine (an annual winter project, in addition to frequent minor pruning during the summer).  I think I either need to get some female kiwi vines and an arbor for them or uproot the male kiwi.  There is really not much point to having just a male kiwi intent on taking over a big chunk of the yard.

There are still a lot of blackberry roots out there that will sprout new vines.  I’ll try uprooting them where I have access (not where they are coming through the cracks in the concrete), but I’ll probably have to do a monthly sweep of the yard to remove blackberries for the rest of my life in this house.

2020 August 17

PteroDAQ installation video

Filed under: Circuits course — gasstationwithoutpumps @ 21:52
Tags: , , , ,

As part of my lecture videos for the first half of the electronics course, I’ve created a video on installing PteroDAQ:

and put in the playlist Applied Analog Electronics Part A.  The instructions are only for macos, but similar steps are needed on Linux and Windows machines.

2015 September 25

Teensy 3.2 available

Filed under: Circuits course,Data acquisition — gasstationwithoutpumps @ 08:22
Tags: , ,

A new board in the Teensy series, the Teensy 3.2, has just been released.  It is almost identical to the Teensy 3.1, but has a better 3.3V regulator, so that more 3.3V power can be used by peripherals.  We’ll have to make some tiny changes to the PteroDAQ data acquisition system so that it will recognize the Teensy 3.2, but nothing major, as it will use exactly the same code as the Teensy 3.1.  I’ll have to reinstall the Teensyduino development system and find out how (or whether) it distinguishes between the boards.

(Update 2015-Sept-19:00:  The Teensyduino software treats the Teensy 3.1 and Teensy 3.2 identically, so there is nothing that needs to be done to PteroDAQ but to change some info items to be “3.1/3.2” instead of “3.1”.)

The addition of the voltage regulator is a substantial improvement to the board, allowing about 500mA of current on the 3.3V line, rather than the 100mA limit of the Teensy 3.1.

I still think I’ll recommend the Teensy LC for the electronics class, as a somewhat better price/performance ratio for the needs of the class, but the Teensy 3.2 is a good choice if you need a little more processing speed or the more complex DMA capabilities.

2015 August 28

DMA counter for event counting on Freescale Kinetis processors

Filed under: Circuits course,Data acquisition — gasstationwithoutpumps @ 18:25
Tags: , , , , , ,

The application note mentioned in PteroDAQ frequency channels is Freescale’s AN5083Using DMA for pulse counting on Kinetis, which I finally got around to looking up and reading today, after implementing frequency channels on the KL26, KL25, and K20 processors (Teensy LC, FRDM-KL25Z, and Teensy 3.1 boards, respectively).  The reason I looked it up finally was to look for a workaround for the biggest problem—namely that the CITER counter on the K20 has a maximum of 32767.  If I’m counting at the highest frequency (supposedly 8MHz or 6.26MHz, depending which documentation I believe, but I’ve not been able to get measurements much above 4MHz), that requires sampling at 125–245Hz or faster. But I often want to sample at factors of 60Hz, to alias out any frequency modulation from line interference.  The cruder DMA systems of the KL25 and KL26 use a 20-bit counter, and should be able to count to 4-5MHz (though they are likely to top out at 3MHz), so I could sample as slowly as once every 3.8s, even at the highest measurable input frequency.

I had no problem getting the counting to work with the 15-bit DMA_TCD_CITER counter. I can live with the 32767 count limit (at 60Hz sampling, that would be a 1.966MHz limit on the counting), but I wanted to see if I could use the optional interrupt that can be set up when the CITER counter ends to increment a software counter and reset the DMA counting.  That should give me an arbitrarily wide counter, at the cost of perhaps missing a count at the wraparound (an error of 30.5ppm, about the same as the clock error).

Unfortunately, AN5083 merely explains what I had already figured out for myself—without even the essential warning that you need a NOP after disabling the DMAMUX before looking at the counter to avoid a race condition on the KL25 and KL26:

    (&DMAMUX0_CHCFG0)[0] &= ~(DMAMUX_ENABLE);       // turn off at DMAMUX
    __asm__ volatile( "nop" );
    uint32_t count = 0xfffff - (DMA_DSR_BCR0 & 0xfffff);

They only say

The major loop counter of the DMA register DMA_TCDn_CITER_ELINKNO is limited to 15 bits, in the case where the channel linking feature of the DMA is not in use (refer to DMA chapter in the Reference Manual). Therefore, there is a limitation of 32K major loops count. So, user must check CITER register and make sure it will not reach to zero. If, CITER reaches zero, BITER will reload the value from BITER register.

I tried for a good chunk of yesterday to get the code working with the interrupt.  I can get the interrupt to occur (detected by turning off an LED in the interrupt return), I can read the longer frequency counter (detected by turning off an LED if the count to return is >32767), and the count is returned to be pushed on the queue, but something gets wedged and that longer count is never output to the host.

The processor needs to be power-cycled, the same as if the processor had gone into an infinite loop (which is what the Teensyduino unimplemented_isr routine does). I did disable the DMA error interrupt routine (with DMA_CEEI), so that isn’t the problem.  I even confirmed this by enabling the error interrupt and providing a dma_error_isr routine that turns off the LED, but the LED did not turn off.  I also checked the DMA_ES register at the beginning and end of the dma_ch0_isr routine and in the routine that reads the counter, and DMA_ES was always 0.  So if there is an error, it is not being reported by the hardware.

I suppose that an SWD debugging interface (not available on the Teensy 3.1 board) might be useful here, as I could at least check my conjecture that the processor is looping in the fault_isr routine.  It may be wedged somewhere else.  And there is always the possibility that there is an undocumented hardware bug (like the race condition between DMAMUX disabling and reading DMA_DSR_BCR on the KL26) that requires some workaround that I haven’t thought of yet.

I’ve given up on the higher resolution counters for Teensy 3.1 for now and just pushed the 15-bit implementation (with the interrupt code mostly commented out) to the BitBucket PteroDAQ repository.  If anyone reading this blog is familiar with the DMA interrupts on the K20 processor, please look at the code in kinetis_frequency.c and tell me what I’m doing wrong!

2015 August 25

PteroDAQ frequency channels on FRDM-KL25Z

Filed under: Circuits course,Data acquisition — gasstationwithoutpumps @ 23:53
Tags: , , , , ,

In PteroDAQ frequency channels I said

The next step for me is to implement frequency channels for the FRDM-KL25Z board (pretty much identical to the KL26 on the Teensy LC, except for having to use the MBED syntax for the register setting rather than the one Teensyduino uses) and the Teensy 3.1 board (the K20 DMA is much more complicated, so it will probably take me a while to figure out and set up—especially if it also has undocumented race conditions). Once I get those working, I’ll have to figure out how to do the GUI so that people can quickly figure out that which combinations of frequency channels are legal. I’ll probably want to do that with separators in a menu, greying out sections that already have frequency channels in use.

I got about half of that done today.  I started out with how to grey out the frequency channels that were inaccessible (because another pin on that port was being used)—but doing that lead me to needing to list all the current channels, which was done in several different places already and was rather awkward.  From there I decided to clean up and refactor a lot of the GUI code, which had gotten rather long and confusing.

So most of the day was spent on refactoring the GUI, breaking it up into classes and getting rid of global variables.  I think that the GUI code is more maintainable  now, but there are still a few things that feel like they are in the wrong place in the code, so some stuff may move around a little in future releases.

After the refactoring, greying out the unavailable frequency pins was pretty easy, and I’m reasonably happy with the user interface for pin selection now, though I think I need a new icon for frequency measurement.  I have a period of a sine wave for analog channels, and a period of a square wave for digital channels, but I don’t have as obvious an icon for frequency channels.  (I was considering just a big “Hz”, but that would not look compatible with the sine and square wave icons.)

Adding frequency channels for the FRDM KL25Z board did not take long—the biggest trouble was converting the KL26 code for the Teensy LC into MBED’s format for accessing registers.  Just about everything else is the same (except that the KL25 has only 2 ports that can control the DMA counters: A and D, rather than the 3 (A, C, and D) of the KL26. I have pushed the code for the frequency channels up to the PteroDAQ site on BitBucket.

I don’t know whether I’ll get the Teensy 3.1 code done tomorrow—I have to go into the office for office hours and for the banana slug genomics meeting, and I need to start working on my biobibliography and teaching/research statements for my merit review.  They are due early in September, and I’ve not started on them yet.

I hope to have the frequency channels working on the Teensy 3.1 by the end of the week, so that I can rewrite the chapter of my book on the hysteresis oscillator, to use the frequency channels, rather than a separate frequency detecting program as I used for the last couple of years.

Next Page »

%d bloggers like this: