issue using UART0 and I2C0

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

issue using UART0 and I2C0

Jump to solution
933 Views
gschelotto
Contributor V

Hi,

I've configured with KDS 3.0 my FRDM-MKE02Z as shown

Untitled.png

If I use I2C0 (master) and UART0 separately in my application everything goes well. I'm able to Rx/Tx information through both modules. However, while I access to my I2C slave (an MCP23017 I/O Expander) and I receive some information on UART0 Rx (by a modbus polling), the CI2C1_SendBlock function returns an ERR_BUSY error. And the MCP cannot recover anymore.

UART0 share pins with I2C0 but PE has not notify of any errors so I assume that pinmux are set correctly. What could be the problem?

I'd appreciate any help.

regards,

gaston

0 Kudos
1 Solution
674 Views
mjbcswitzerland
Specialist V

Hello Gaston

Normally all peripherals can operate in parallel so I don't recommend doing anything like disabing one in order to use another.

What peripheral drivers and operating system are you using? If you are using example drivers you will need to investigate each one's operation because they may have been created to illustrate a single case but not be able to work in a real project environment without modification/re-design. Are they pollig or are they interrupt driven? Are then blocking or non-blocking?

How much RAM is used in the system (the KE02 has only 4k RAM) and do you have any issues with stack overflow?

Regards

Mark

Kinetis: µTasker Kinetis support

KE: µTasker FRDM-KE02Z support  / µTasker FRDM-KE02Z40M support  / µTasker FRDM-KE06Z support

UARTs: http://www.utasker.com/docs/uTasker/uTaskerUART.PDF

I2C: http://www.utasker.com/docs/uTasker/uTaskerIIC.PDF

MODBUS (Master/Slave/Gateway/Router/RTU/ASCII/RS485/TCP): µTasker MODBUS Extension pack

For the complete "out-of-the-box" Kinetis experience and faster time to market

View solution in original post

0 Kudos
5 Replies
674 Views
mjbcswitzerland
Specialist V

Hallo Gaston

The pin muxing on the KE devices is automatically controlled by the peripheral functions (eg. when the UART is enabled, its pins are connected as long as there is not another peripheral enabled which has a higher priority than it on the pins in question).

Therefore I don't think that you have a pin muxing issue but rather a software/concept issue when both peripheral are operating together.

Regards

Mark

Kinetis: µTasker Kinetis support

KE: µTasker FRDM-KE02Z support  / µTasker FRDM-KE02Z40M support  / µTasker FRDM-KE06Z support

UARTs: http://www.utasker.com/docs/uTasker/uTaskerUART.PDF

I2C: http://www.utasker.com/docs/uTasker/uTaskerIIC.PDF

MODBUS (Master/Slave/Gateway/Router/RTU/ASCII/RS485/TCP): µTasker MODBUS Extension pack

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 Kudos
674 Views
gschelotto
Contributor V

Mark, thanks for your help

Therefore I don't think that you have a pin muxing issue but rather a software/concept issue when both peripheral are operating together.

Indeed, both peripherals must to work together. What software/concept should I take into account?

ie. should I Dissable/Enable the UART module before using the I2C?

regards,

gaston

0 Kudos
675 Views
mjbcswitzerland
Specialist V

Hello Gaston

Normally all peripherals can operate in parallel so I don't recommend doing anything like disabing one in order to use another.

What peripheral drivers and operating system are you using? If you are using example drivers you will need to investigate each one's operation because they may have been created to illustrate a single case but not be able to work in a real project environment without modification/re-design. Are they pollig or are they interrupt driven? Are then blocking or non-blocking?

How much RAM is used in the system (the KE02 has only 4k RAM) and do you have any issues with stack overflow?

Regards

Mark

Kinetis: µTasker Kinetis support

KE: µTasker FRDM-KE02Z support  / µTasker FRDM-KE02Z40M support  / µTasker FRDM-KE06Z support

UARTs: http://www.utasker.com/docs/uTasker/uTaskerUART.PDF

I2C: http://www.utasker.com/docs/uTasker/uTaskerIIC.PDF

MODBUS (Master/Slave/Gateway/Router/RTU/ASCII/RS485/TCP): µTasker MODBUS Extension pack

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 Kudos
674 Views
gschelotto
Contributor V

Mark, I think the problem is how I use CI2C1 component create by PE. I implemented my own I2C (GPIO based) and everything goes well. Currently I have no time to investigate what going on with CI2C1 but I've noticed that its description indicates a 'Legacy' High Level Component. What does it means? Will it be removed in future versions and should I avoid to use it? I'm not able to find much support about this.

regards,

gaston

0 Kudos
674 Views
gschelotto
Contributor V

Solved! I had found a silly mistake in my code...

It's a long time ago post but I've just realized it was not answered. Mark, thank you for helping.

regards,

gaston

0 Kudos