cnlohr / ch32v003fun

Open source minimal stack for the ch32 line of WCH processors, including the ch32v003, a 10¢ 48 MHz RISC-V Microcontroller - as well as many other chips within the ch32v/x line.
MIT License
893 stars 142 forks source link

Are there defined symbolic constants for AFIO_EXTICR register values? #299

Closed IvanLi-CN closed 4 months ago

IvanLi-CN commented 5 months ago

I tried using the following set of definitions, but found that the values were different from those in the manual. https://github.com/cnlohr/ch32v003fun/blob/7b87b3fc33d96cf10b934985e13ce63602dd8457/ch32v003fun/ch32v003fun.h#L4737-L4773

Here's a snippet of my code.

  // Enable interruptions for PC0, PC1
  AFIO->EXTICR |= AFIO_EXTICR1_EXTI0_PC | AFIO_EXTICR1_EXTI1_PC;

  // Enable interruptions
  EXTI->INTENR |= EXTI_INTENR_MR0 | EXTI_INTENR_MR1;
  EXTI->FTENR |= EXTI_FTENR_TR0 | EXTI_FTENR_TR1;

Below is a screenshot of the manual.

image

I see that the example is directly assigned, but I found a similar defined, but the value does not meet my expectations. I don't know if there is a problem with my usage, I need help, thank you for this project and you who see this issue.

cnlohr commented 4 months ago

I believe this has been corrected at another time, I don't recall the specific commit. Can you check again?

IvanLi-CN commented 4 months ago

@cnlohr Thanks for the reply. I just rechecked the code in the master branch and the problem persists. I compared the documentation for CH32V203 and it seems that CH32V003 is completely different from the others in this section.

https://github.com/cnlohr/ch32v003fun/blob/8c421623720a64b631d78aa4255abac702fdf40a/ch32v003fun/ch32v003fun.h#L5262-L5301

image
prosper00 commented 4 months ago

i ran into the same thing. will be opening up a PR in the next couple of days. In the meantime, you can copy/paste the defines from 'funconfig.h' in my repo here:

https://github.com/prosper00/Encoder-i2c

Apr 28, 2024 6:07:00 a.m. Ivan Li @.***>:

@cnlohr[https://github.com/cnlohr] Thanks for the reply. I just rechecked the code in the master branch and the problem persists. I compared the documentation for CH32V203 and it seems that CH32V003 is completely different from the others in this section.

https://github.com/cnlohr/ch32v003fun/blob/8c421623720a64b631d78aa4255abac702fdf40a/ch32v003fun/ch32v003fun.h#L5262-L5301

image.png (view on web)[https://github.com/cnlohr/ch32v003fun/assets/30215105/69a9ad24-0a31-42c1-8df6-0f404c4a8098]

— Reply to this email directly, view it on GitHub[https://github.com/cnlohr/ch32v003fun/issues/299#issuecomment-2081458722], or unsubscribe[https://github.com/notifications/unsubscribe-auth/ANVXEPIW3HLVCVZODSZ63ALY7TQ6JAVCNFSM6AAAAABFY4X3O2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBRGQ2TQNZSGI]. You are receiving this because you are subscribed to this thread. [Tracking image][https://github.com/notifications/beacon/ANVXEPP5FWPZPBK55NVL6HTY7TQ6JA5CNFSM6AAAAABFY4X3O2WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTT4CCFCE.gif]

cnlohr commented 4 months ago

i ran into the same thing. will be opening up a PR in the next couple of days. In the meantime, you can copy/paste the defines from 'funconfig.h' in my repo here: https://github.com/prosper00/Encoder-i2c Apr 28, 2024 6:07:00 a.m. Ivan Li @.***>:

Would you like me to make a PR on your behalf, it would be good to fix this.

prosper00 commented 4 months ago

i opened on this morning: [cnlohr/ch32v003fun] Pull request opened: #309 Exti defs

Apr 28, 2024 2:22:01 p.m. CNLohr @.***>:

i ran into the same thing. will be opening up a PR in the next couple of days. In the meantime, you can copy/paste the defines from 'funconfig.h' in my repo here: https://github.com/prosper00/Encoder-i2c Apr 28, 2024 6:07:00 a.m. Ivan Li /@/.***>:

Would you like me to make a PR on your behalf, it would be good to fix this.

— Reply to this email directly, view it on GitHub[https://github.com/cnlohr/ch32v003fun/issues/299#issuecomment-2081641041], or unsubscribe[https://github.com/notifications/unsubscribe-auth/ANVXEPM2BQHL2L5WUXA3V6TY7VK6TAVCNFSM6AAAAABFY4X3O2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBRGY2DCMBUGE]. You are receiving this because you commented. [Tracking image][https://github.com/notifications/beacon/ANVXEPPWF5HUHB6IYBDPA7TY7VK6TA5CNFSM6AAAAABFY4X3O2WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTT4CNJFC.gif]