New Ports and SPI2, and SPI3 - Crashing

General discussion on mikroC PRO for ARM.
Post Reply
Author
Message
thiagoalberici
Posts: 69
Joined: 04 Jul 2012 12:52

New Ports and SPI2, and SPI3 - Crashing

#1 Post by thiagoalberici » 18 Aug 2015 21:28

First of all, I made a program to test the digital ports of my LM4F232H5QD on my EasyMx PRO v7 for Stellaris ARM.
I was careful to:
Leave out the doors PC0, PC1, PC2 and PC3, used by JTAG;
Unlock, by software, the locked doors PD7 and PF0;
Took care of the adaptations of PB6-PK6, PB7-PK7, PD0-PN0, PN1-PD1, PD2-PK4, and PD3-PK5 doors;
The test was a success, all the LEDs blink.

Now, for a second test, I used a clickboard (ETH click).
I declared it in _GPIO_MODULE_SPI0_A245. I tested the Ethernet module in parallel with the other ports (digital) with the blinking LED.
Everything working again.

However, when I repeated the second test, changing the click board to _GPIO_MODULE_SPI2_H467 and to _GPIO_MODULE_SPI3_H023, the processor crashed.
Some tests revealed that if I have something declared in SPI2 and SPI3, with led blinking, the processor crashes.
The crashes happend in the moment that I changed the status of any of the adapted ports (PB6-PK6, PB7-PK7, PD0-PN0, PN1-PD1, PD2-PK4, PD3- PK5).
If I comment the change of status of those doors, everything works again.

Why can´t I use the PB6-PK6, PB7-PK7, PD0-PN0, PN1-PD1, PD2-PK4, PK5-PD3 doors as digital in parallel with SPI2 or SPI3?

Thanks. Att,

thiagoalberici
Posts: 69
Joined: 04 Jul 2012 12:52

Re: New Ports and SPI2, and SPI3 - Crashing

#2 Post by thiagoalberici » 27 Aug 2015 14:08

Any thoughts?

User avatar
aleksa.jovanovic
Posts: 526
Joined: 30 Jun 2015 08:48

Re: New Ports and SPI2, and SPI3 - Crashing

#3 Post by aleksa.jovanovic » 28 Aug 2015 16:14

Could you send me both project variants so I can see it working and not working?

Best regards,
Aleksa

thiagoalberici
Posts: 69
Joined: 04 Jul 2012 12:52

Re: New Ports and SPI2, and SPI3 - Crashing

#4 Post by thiagoalberici » 04 Sep 2015 20:45

I'm sending you a single project to test both things.
One sec after the beginning, i start blinking a led on a old port (PA0) and nothing happens.
After 3 seconds, i set some new port (PK or PN) and it crashes.
The code is commented...

Thank You for the attention,
[]s
Attachments
Spi3_NewPorts Stellaris LM4.rar
(221.75 KiB) Downloaded 225 times

User avatar
aleksa.jovanovic
Posts: 526
Joined: 30 Jun 2015 08:48

Re: New Ports and SPI2, and SPI3 - Crashing

#5 Post by aleksa.jovanovic » 07 Sep 2015 16:46

Try putting it like this

Code: Select all

SPI3_Init_Advanced(1000000, _SPI_MASTER, _SPI_8_BIT, &_GPIO_MODULE_SPI3_H023);
  //Old Port as Digital
  GPIO_Digital_Output(&GPIO_PORTA_DATA_BITS, _GPIO_PINMASK_0);//PA0
  //New Ports as Digital
  GPIO_Digital_Output(&GPIO_PORTK_AHB_DATA_BITS, _GPIO_PINMASK_6);//PB6_PK6
  //SPI3 on H023
So the SPI init is before the GPIO functions.

See if it works and report back.


Best regards,
Aleksa

thiagoalberici
Posts: 69
Joined: 04 Jul 2012 12:52

Re: New Ports and SPI2, and SPI3 - Crashing

#6 Post by thiagoalberici » 08 Sep 2015 22:19

Hi there, i changed the order like you said (first the spi and then the digital ports) and it works!
First, thanks for the solution! But, any ideas why does the order matter?
Where did you came with this solution from?
Best regards,

User avatar
aleksa.jovanovic
Posts: 526
Joined: 30 Jun 2015 08:48

Re: New Ports and SPI2, and SPI3 - Crashing

#7 Post by aleksa.jovanovic » 09 Sep 2015 08:38

Hi,

Honestly it was a trial and error kind of thing.
The SPI init does something to those ports, which we've monitored in debug mode,
but couldn't figure out yet. We will see through it.

Best regards,
Aleksa

Post Reply

Return to “mikroC PRO for ARM General”