Hello,
does anybody know why the sci code i wrote on a zmvl128 does not work on the zmvl31?
the zmvl128 sends the corresponding value.
the zmvl31 wont send or receive anything
void HwAb_InitSci(void)
{
MODRR = 0x00; // LIN Routing
SCI0BD = 0x00D9;
SCI0CR2 = 0x2c // Receiver full interrupt, tx enable, rx enable
}
void HwAb_SciTransmit(uint8 value)
{
while(!SCI0SR1_TDRE); //wait for transmit data register empty flag
SCI0DRL = value; //send
}
Thanks
PS: yes, i changed the header file
Hi Fabian,
Could you please specify the maskset of your zmvl128 MCU?
The early masksets (N06E) used SCIV5 while all current S12Z devices use SCIV6.
The difference is in enhanced baud rate options.
For SCIV5:
SCI baud rate = SCI bus clock / (16 x SBR[12:0])
For SCIV6:
SCI baud rate = SCI bus clock / (SBR[15:0])
You route signal to LIN PHY. Did you enable LIN PHY in both cases?
Should not be there “MODRR0 = 0x00;” instead “MODRR = 0x00;”
Note: The MODRRx registers could be written just once in normal mode. Please ensure that you configured it just once in your code.
I hope it helps you.
Have a great day,
Radek
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Radek,
thanks for the quick response.
MODRR0 was a copy paste error.
the maskset is 1N95G.
i enable LIN with:
LP0CR = LP0CR_LPPUE_MASK + LP0CR_LPWUE_MASK + LP0CR_LPE_MASK;
Fabian
Hi Fabian,
Thank you for more details.
Unfortunately, I don’t have here any board with s12zmvl31 MCU and currently I have no idea what else might be wrong.
Please ensure you hardware connection.
The recommended SCI initialization contains also SCICR1 register configuration. It should not have any impact, but could you please just add such command into your HwAb_InitSci() function? For example:
void HwAb_InitSci(void)
{
MODRR = 0x00; // LIN Routing
SCI0BD = 0x00D9;
SCI0CR1 = 0x00;
SCI0CR2 = 0x2c; // Receiver full interrupt, tx enable, rx enable
}
BTW: there missing “;” at end of your command with write into SCI0CR2 register.
I hope it helps you.
Have a great day,
Radek
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------