Skip to content

[BUG] I2C PMD setting issue for PIC18Fx7Q43 devices #383

@StrahinjaJacimovic

Description

@StrahinjaJacimovic

Describe the bug

Noticed the following issue for PIC devices (i.e. PIC18F57Q43):

  • PMD register bits for I2C seem to be incorrect
    • HAL_LL_SSP1_MODULE_BIT for example

To Reproduce

Simply run any i2c code for this PIC18F57Q43 and add the following line at the top of the application:

*(uint8_t *)0x066 |= 1; // Disable I2C1 module

Expected behavior

The expected behavior is for the SDK library to re-enable module power.

Screenshots

None

Information (please complete the following information):

  • OS: Any
  • SDK version 2.14.4
  • HW related to issue (board, MCU, etc.)
    • MCU Card 11 for PIC with PIC18F57Q43
    • EasyPIC PRO v8

Additional context

Problem is related to incorrect macro value for I2C PMD bit.

Suggestion is to create a macro to macro redefinition in I2C source files, as SPI macros seem to be correct.

General suggestion:

#ifdef HAL_LL_I2C1_MODULE_BIT
    #define HAL_LL_I2C1_PMD_MODULE_BIT HAL_LL_I2C1_MODULE_BIT // Use new correct approach
#else
    #define HAL_LL_I2C1_PMD_MODULE_BIT HAL_LL_SSP1_MODULE_BIT // Keep old approach
#endif

This requires change in appropriate PMD clear/set functions in low level implementations.


Metadata

Metadata

Assignees

Labels

bugSomething isn't workingenhancementNew feature or request

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions