Setting a MISO pin to 0 as an IO

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

Setting a MISO pin to 0 as an IO

1,247 Views
danjiga
Contributor I

Hello,

I am using a BLE (Bluetooth Low Energy) controller that is connected via SPI to a Kinetis controller. At one moment, in order to trigger a transmission from the BTLE controller, I have to set the MOSI pin to a 0 level, but as much as I tried, Icouldn't. I have defined the MOSI pin as a shared pin in PE but I wasn't able to pull it to GND. Can you please help me?

Thanks,

Regards,

Dan

0 Kudos
6 Replies

937 Views
martynhunt
NXP Employee
NXP Employee

Hi Dan,

Could you please specify which Kinetis device you are using? Also, would you mind posting the data sheet for the BLE controller you are trying to communicate with? Thank you.

Best regards,

Martyn

0 Kudos

937 Views
danjiga
Contributor I

Hello Martyn,

I am using an MKL25Z128VFT4 in QFN 48-pin package in PE and here, attached, you have the EM9301 data sheet. In the data sheet, the step where it's necessary for me to pull the MISO line to GND is in chapter 7.2.2 (SPI flow control), in the step 2) of the "Controller-to-host flow" subchapter.

Thanks,

Regards,

Dan

0 Kudos

937 Views
martynhunt
NXP Employee
NXP Employee

Hi Dan,

Thank you for the update. I would first try to just send 0x00 over SPI and see if you can receive data, ignoring step 2 (pull MOSI down). 

If that does not work, I would then try to mux the MOSI pin as a GPIO for Controller-to-host flow. Set the GPIO low for the duration of the transfer. For example if using PTC6 (pin number 39 on QFN-48) for SPI0_MOSI,

In Host-to-controller flow: PORTC_PCR6 = PORT_PCR_MUX(2);

In Controller-to-host flow: PORTC_PCR6 = PORT_PCR_MUX(1);

                                     GPIOC_PDDR |= (1 << 6);

                                     GPIOC_PDOR &= ~(1 << 6);

Please let me know if either of these solutions are successful for your application, or if you need additional assistance. Thank you.

Best regards,

Martyn

0 Kudos

937 Views
danjiga
Contributor I

Hello Martyn,

Sorry for the late reply, I was occupied with other tasks. I still have one more (sub)question about using the pin with two functions (SPI MOSI and GPIO - digital output): As I have to use Processor Expert to generate the interfaces and services, is there a particular way of defining an alternate function pin in PE?

Thanks,

Cheers,

Dan

0 Kudos

937 Views
vfilip
NXP Employee
NXP Employee

Hello,

you should be able to create such project. You just need to right click on pin item and enable pin sharing. When you do that please do not forget to call ConnectPin method to write correct mux value before using corresponding pin.

You can find also more details in PEx cheat-sheets in CW or in general PEx help.

Best regards

Vojtech Filip

Processor Expert Support Team

0 Kudos

937 Views
danjiga
Contributor I

Hello all,

Finally (the project was somehow of a background prio) I did this, not by using the ConnectPin method, but by using a function that was altering the pin function, more or less like Martyn suggested. And it worked flawlessly.

So, thank you guys for the kind support,

Best regards,

Dan

0 Kudos