Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpu: mips_pic32_common: Implement GPIO IRQ #13820

Merged
merged 5 commits into from May 4, 2020

Conversation

francois-berder
Copy link
Contributor

Contribution description

This PR implements periph_gpio_irq for PIC32 devices. It also updates the SAUL configuration on the pic32-clicker and pic32-wifire.
Note that the implementation differs slightly between PIC32MX and PIC32MZ. While implementing this feature, it appeared that the PIC32MX is only able to trigger interrupts on any edge. This means that it will probably be less reliable than on the PIC32MZ.

Testing procedure

Build and flash test/buttons on a pic32-clicker or pic32-wifire. On a pic32-wifire, pushing a button pulls the line to 3V3, while on pic32-clicker, pushing a button pulls down the line.

Issues/PRs references

None

@benpicco benpicco added Area: cpu Area: CPU/MCU ports Type: new feature The issue requests / The PR implemements a new feature for RIOT labels Apr 5, 2020
@MrKevinWeiss MrKevinWeiss added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Apr 13, 2020
@MrKevinWeiss
Copy link
Contributor

I tested on the pic32-wifire and everything works as expected with both the tests/buttons and examples/default with SAUL.

I also tried on the pic32-clicker but seemed to have some problems with the terminal, it appears that BOARD=pic32-clicker make term doesn't return anything (even an error) so I added a USB to UART converter and connected it to the RX and TX pins before finding out that they are not the correct pins... I don't know why the RF5 and RF4 were chosen as on the board they indicate I2C lines.

I digress, I attached the lines to the RF4/5 and tried to get some terminal output... Still nothing so I tried just the tests/leds... nothing.

I also noticed that the LEDs on the board say LD1(RD4) and LD2(RD1) and in the board.h the LEDs were set to PB1 and PB2. So I tried to change it and reflashed the tests/leds with what should be fixed LED porting.

It seems like you have the pic32-clicker working, does the tests/leds actually work?
How do you flash the pic32-clicker?
I use BOARD=pic32-clicker BUILD_IN_DOCKER=1 make flash -C tests/leds with the pickit3 updated as per the documentation in dist/tools/pic32prog/doc.md

@francois-berder
Copy link
Contributor Author

I think you simply do not have the right board. Given your comments, it seems that you have a PIC32MX clicker while pic32-clicker actually refers to the 6LoWPAN clicker. Yes, it is confusing and we should definitely rename the board.

I also tried on the pic32-clicker but seemed to have some problems with the terminal, it appears that BOARD=pic32-clicker make term doesn't return anything (even an error)

Both boards do not share the same CPU so I am not surprised that you see nothing in the terminal. I assume other changes in the code are needed.

It seems like you have the pic32-clicker working, does the tests/leds actually work?

I do not think I tried this test before but I was able to turn on LEDs using SAUL when the clicker was programmed with examples/default

How do you flash the pic32-clicker?

I use a pickit 2 with pic32prog, it is slow but it works. Unfortunately, it seems that the pinout of the connector on the left side of the board does not match the standard Microchip ISCP on the PIC32MX clicker.

Signed-off-by: Francois Berder <18538310+francois-berder@users.noreply.github.com>
Signed-off-by: Francois Berder <18538310+francois-berder@users.noreply.github.com>
Signed-off-by: Francois Berder <18538310+francois-berder@users.noreply.github.com>
Signed-off-by: Francois Berder <18538310+francois-berder@users.noreply.github.com>
Signed-off-by: Francois Berder <18538310+francois-berder@users.noreply.github.com>
Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me - maybe @MrKevinWeiss can give it another test?

@benpicco benpicco added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels May 2, 2020
@MrKevinWeiss
Copy link
Contributor

I think you simply do not have the right board. Given your comments, it seems that you have a PIC32MX clicker while pic32-clicker actually refers to the 6LoWPAN clicker. Yes, it is confusing and we should definitely rename the board.

Doh! That explains it 😄

Looks good to me - maybe @MrKevinWeiss can give it another test?

Will do, just need to get to the hardware, should be by the end of the day.

@MrKevinWeiss
Copy link
Contributor

Retested on the wifire and it works. As I don't have the clicker this is the best we can get!

@benpicco benpicco merged commit 3c03394 into RIOT-OS:master May 4, 2020
@benpicco
Copy link
Contributor

benpicco commented May 4, 2020

I think that's good enough :)

@francois-berder francois-berder deleted the pic32-gpio-irq branch May 5, 2020 06:59
@miri64 miri64 added this to the Release 2020.07 milestone Jun 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: cpu Area: CPU/MCU ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants