Bicycle speedometer

I have no idea how to compile the code unfortunately, I believe it may be my pokitto I need to test it to see it the header is good

I’m getting 3.2 volts on the pin and .31 when it’s wired up for the sensor.
I tried setting the polarity one way them the other but nuthing.

Also tried the metric version and got no response with it either.

The program sets an internal pull-down resistor on the EXT0 pin, so you should normally get 0 volts, and 3.2 volts only when the reed switch is connected and you bring magnet next to it.

I tried to make a version that uses other pins as input but strangely it didn’t work. The pull-down resistors seem to be activated correctly but my program receives no interrupts from pins other than EXT0.

It’s probably my pokitto

Let me take a look at this and get back to you

It is highly unlikely, that a single pin is not working on an otherwise functional pokitto - though it is possible

1 Like

To verify the hardware, it would be best to have a simple program that sets a pin to input mode with pulldown and then polls it continually and outputs its state to the display. You could do this for more than one, or all, the PEX inputs at the same time.

Anything you need me to do?

Wait patiently. I was kinda busy. I will get back to this soon

1 Like

Here is a program to test EXT0-17 pins in the PEX header. It enables pull-down resistors and attaches interrupt handler to all EXT pins. The program displays total number of detected interrupts and shows pin states by highlighting pins with ‘high’ state.

Binary: ExtTester.bin (53.3 KB)
Source: ExtTester.zip (4.7 KB)

This is what it shows for my Pokitto:
        Input   IRQ
EXT0    +       +
EXT1    -       -
EXT2    -       -
EXT3    +       +
EXT4    +       +
EXT5    +       +
EXT6    +       +
EXT7    +       +
EXT8    +       -
EXT9    +       -
EXT10   +       -
EXT11   +       -
EXT12   +       -
EXT13   +       -
EXT14   +       -
EXT15   +       -
EXT16   +       -
EXT17   +       -

So I got interrupts from EXT0 and EXT3-7.
EXT1 and EXT2 didn’t function as input at all.

5 Likes

I think the following from the documentation can answer some part of the issue (https://www.nxp.com/docs/en/data-sheet/LPC11U6X.pdf):

8.11 Pin interrupt/pattern match engine
The pin interrupt block configures up to eight pins from all digital pins for providing eight
external interrupts connected to the NVIC.
The pattern match engine can be used, in conjunction with software, to create complex
state machines based on pin inputs.
Any digital pin except pins PIO2_8 and PIO2_23 can be configured through the SYSCON
block as input to the pin interrupt or pattern match engine. The registers that control the
pin interrupt or pattern match engine are on the IO+ bus for fast single-cycle access.

If I understand well, that means you might not receive interrupts for more than 8 pins - which seems consistent about why EXT_8-17 aren’t receiving IRQ.

I tested the bin, I got the same input issue about EXT1 and EXT2, but also EXT16. Everything else behave as intended.

Here is a screen shot of mine

I need to try a switch on it right

tried it with a switch and it didn’t register any interrupts with the magnet passed over it, I took it apart and cleaned it and checked the pins they are kinda rough but solid so that shouldn’t be the issue,

image image

The pins in case anyone wants to see them,

Only three pins functioning as inputs? At least EXT0 is among those three, so to my understanding the cyclometer should work.

I now tested also my newer Pokitto and it is not getting input from EXT16, although it worked on the old one.

You are right. If I skip EXT0-7 and enable the rest, then I get interrupts from EXT8-15.

I wonder why the cyclometer seemed to be receiving interrupts only from EXT0? It handles both rising and falling edge, so I guess it’s using 2 (of the 8 available) IRQs per pin. Probably I first added EXT1 and EXT2, then maybe EXT16 and EXT17 from the other end. Thats already wasting all remaining 6 IRQs on pins (EXT1, EXT2, EXT16) from which I didn’t get input anyway.

@jpfli … EXT16 was repurposed to ISP mode set to allow serial programming of Pokitto

Buttons were earlier done with interrupt (7 buttons, 7 interrupts) until it became evident polling is better

That is why only 1 interrupt was available

If you use only polling buttons, you can free up all pin interrupts

#define PROJ_BUTTONS_POLLING_ONLY and other mysteries

2 Likes

D’oh! I actually had PROJ_BUTTONS_POLLING_ONLY in an earlier unpublished version, but it got lost when cleaning up / rewriting the code. Thanks for bringing that up.

4 Likes

Another case showing it should be the default now :wink:

4 Likes

So I’m not crazy, it works just not the version I have downloaded?

The cyclometer works well with one interrupt. I just downloaded the zip file from my earlier message and tested it.

It was my attempt to add more inputs that failed.

1 Like

So the current version (us units) doesn’t work but the original one from oldest post works?

Both versions work.

1 Like

I’ll try it again later today.