Hi is it a way to use port M 2345 as an input while using the can TX RX ?
And is it possible to disable internal pull up on PB4 and PAO ?
I tried already PUCR but no success.
Thank you
Hi,
1) Of course you want to use only CAN. The peripherals are defined for sets of pins not for entire port. So if you use CAN then CAN setup registers control pins assigned for CAN.
2) Setup for input pin at PM[5..2] as input pins.
DDRM &= 0B11000011; // PM[5..2] input pins
RDRM = 0x00; // default…full drive
PERM |= 0B00111100; // enable pull device at PM[5..2]
PPSM &= 0B11000011; // connect pull up to PM[5..2]
3) If the pull resistor is not connected and the pin is set as an input pin then it is in high impedance. So, if you read it then it is not clear what you read. It can be anything.
Best regards,
Ladislav
Thanks for your reply sir Ladislav.
Do you think is it a problem to use internal pull up outside of the main box of the embedded systems that I am building?
I tried to disable the pull up in Port AB and M as I was thinking that external pull up circuit are more safe.
If I can't disable internal pull up I will put a transistor to switch to the ground on every signal that goes out to a remote switch.
An other point that I am thinking about is the way I write to the register.
You suggested DDRA &= B11000011
I do DDRA = 0x00.
Normally the reset state of DDRA is all zero then even if I don't write the register it should be the right setup.
But maybe the way I write to the register is not right. I will try your method.
And do you think I need to setup the pins before or after the CAN initialisation?
Actually I do bus clock then vars initialisation then pin setup then Sci initialisation then CAN initialisation.
Maybe it mess up the port initialisation previously done and I need to initialise the CAN and Sci before the pins.
Will try everything again when I have time.
Regards
Hi,
Best regards,
Ladislav
Ok some news.
Port m not usable as an input i did just swap with port t for the inputs.
Port m work well as an output.
If this is expected its not so clear in the manual.
Finally i find a solution that work then all fine.
Hello @Yaban,
What maskset is it?
It is printed on the package and in the ID register:
Port M pins are GPIO inputs by default.
Regards,
Daniel
Hi.
Why the part I'd have a effect on how the mcu behaves?
I use the CAN bus output on port M and I guess that's why the free pins on port M do not work as inputs with active CAN.
But it still not explain why I can't turn off pull up on PA0 and PB4.
Will add a picture of the chip when I have time.
Thanks for your answer Daniel.
Regards
Every maskset/revision has its errata.
Yes, the CAN module has a higher priority over GPIO.
Also, what is the state of Mode Register (MODE)?
Thank you
First thing I do entering main is write MODE to be in normal single chip. O guess it's a one in MODC.
After I swap port T and M it solved my issue. I use now the free pins in Port M as output and used port T instead.
And I will avoid use PA0 AND PB4 for things like switch to ground outside of the main enclosure.
Is it a list of chip mask vs unwanted behavior available?
Thanks
OK once again
MCU
MC9S12C32CFAE25
1M34CCTGZB1116.
Guys I posted a picture of the mcu... It was removed telling me that it is a spam....
Freescale NXP mcu picture I don't know what kind of spam it was..
Regards
Thanks @Yaban, the number is enough, here are the errata:
https://www.nxp.com/docs/en/errata/MSE9S12C32_1M34C.htm
Unfortunately, nothing related to the issues you see.
The mode of the MCU is rather important, can you double-check in the register view?
The MODC, MODB, and MODA bits in the MODE register show the current operating mode and provide limited mode switching during operation. The states of the MODC, MODB, and MODA pins are latched into these bits on the rising edge of the reset signal.
Regards,
Daniel
Thanks for your answer.
For MODE I did already checked previously.
The demo board I am using have no pull up on the BKGDBM pin and I had to add one that the mcu start in normal mode.
For be sure to be in normal single chip I also write a one in MODC bit at start of the main function.
The only thing that I can't figure out is why PA0 and PB4 can't disable pull up.
All other features work as expected.
I use actually almost all pins and if my application become too large I will switch to s32k mcu.
Thank you
Regards
Here full mcu ref.
MC9S12C32CFAE25
1M34CCTGZB1116
Thank you sir Ladislav for the CAN example.
It will help a lot shorten the dev time of the CAN part of my project.
I will try everything on all ports on what is working or not on every situation with pull up and I/O.
Maybe move some functionality on different pins to be able to get inputs with no pull up on other pins. My problem is that the 48 pins are pretty much all in use already and I have only 3 left on port T.
I need to try if port M free pins 2345 can be used as output instead of inputs then I will be able to swap some pins around for have inputs with no pull up activated.
What bothers me is on paper and in full chip simulation with active can 0 port M work as input with no pull up but in real test on my prototype it's not working.
Whatever thanks a lot.
Regards
Hi,
If the pin contains more alternative functions then, table Table 2-1 Signal Properties, defines priority and the priority is from left(lowest) to right. If more peripherals are enabled at the pin then the peripheral (with highest priority) setup takes precedence over all others. So, the CAN has it own setup.
It is not possible to use these pins with more peripherals. However, there is a PTIM register which can be read in any mode. PTIM …. Port M Input Register — This register always reads back the status of the associated pins. This also can be used to detect overload or short circuit conditions on output pins.
PB4 and PA0… no for individual pin but only for entire port in the PUCR register. The pull resistors are disabled at port A and port B by default after reset. So it is not necessary to do anything to disable them. The question is how you test pull resistor presence. The pull resistor can be implemented in connected device.
Best regards,
Ladislav
Thanks sir Ladislav taking time to answer.
"It is not possible to use these pins with more peripherals. However, there is a PTIM register which can be read in any mode. PTIM …. Port M Input Register — This register always reads back the status of the associated pins. This also can be used to detect overload or short circuit conditions on output pins."
Port M. On 48 pin is can TX RX. And all spi pins. I am not using the spi pins but I use the can ones. I try to use the other spi pins as inputs for some rotary switch to switch between tables. But even if I set them as input in the DDRM. They don't work as an input.
With a pull up circuit and a switch to gnd they don't change anything in the PTIM register.
I will try to use them as output to see if it's a question about setup. I read in some cases they are forced to be input or output but it's not clear in the datasheet.
About the PA0 and PB4 I know pull up are enabled because I tried it physically. I use a dragonfly board to a broad to build prototype circuit. The PORTAB register give me 0 and 1 when I put the pins at the ground and they read 5v continually. I disabled both pull up in the PUCR but it have zero effects.
Maybe have something that I am missing there.
Thanks again
Hi @Yaban,
I'm sorry for the delay.
You wrote:
About the PA0 and PB4 I know pull up are enabled because I tried it physically. I use a dragonfly board to a broad to build prototype circuit. The PORTAB register give me 0 and 1 when I put the pins at the ground and they read 5v continually. I disabled both pull up in the PUCR but it have zero effects.
I'm still not sure how you tested it. If you connect the pins to either VDD or VSS, it will always drive the pin to VDD or VSS because the internal pull device is weak.
Try connecting the pin to VSS via a resistor. If the pull-up is enabled, you will measure positive voltage at the pin.
Regards,
Daniel