SPI on AVR32UC3

classic Classic list List threaded Threaded
8 messages Options
Richard Graham Richard Graham
Reply | Threaded
Open this post in threaded view
|

SPI on AVR32UC3

Hi again,

It seems I am having problems with communications over SPI with my
board. I'm not getting any error messages but basically nothing happens,
no SPI clock signal or data. I also noticed I can't toggle the CS line
with spi.sson.

I have done some basic checks such as that the SPI pins setup correctly
in my board config, but I'm out of ideas at the moment of further things
to check. I was wondering if anyone had seen this before or has any
other ideas.

Thanks,
--
Richard
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Martin Guy Martin Guy
Reply | Threaded
Open this post in threaded view
|

Re: SPI on AVR32UC3

On 22/05/2014, Richard Graham <[hidden email]> wrote:
> It seems I am having problems with communications over SPI with my
> board. I'm not getting any error messages but basically nothing happens,
> no SPI clock signal or data. I also noticed I can't toggle the CS line
> with spi.sson.
>
> I have done some basic checks such as that the SPI pins setup correctly
> in my board config, but I'm out of ideas at the moment of further things
> to check. I was wondering if anyone had seen this before or has any
> other ideas.

Hi Richard
  I was never able to test the SPI support in AVR32UC3A, except for
adding LEDs to the pins to see if the signals looked OK. The SD card
is on SPI, so the low-level code works OK, but the Lua interface and
whether it works or not is to be seen
  I dunno about the UC3B - do you have an SD card on your board and
does it work?

     M

  Sorry I can't be more
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Richard Graham Richard Graham
Reply | Threaded
Open this post in threaded view
|

Re: SPI on AVR32UC3

Hi,

I don't an SD card or extra memory, basically just a UC3B and a single
DDS chip on the SPI bus.

--
Richard


On 05/22/2014 11:04 AM, Martin Guy wrote:

> On 22/05/2014, Richard Graham <[hidden email]> wrote:
>> It seems I am having problems with communications over SPI with my
>> board. I'm not getting any error messages but basically nothing happens,
>> no SPI clock signal or data. I also noticed I can't toggle the CS line
>> with spi.sson.
>>
>> I have done some basic checks such as that the SPI pins setup correctly
>> in my board config, but I'm out of ideas at the moment of further things
>> to check. I was wondering if anyone had seen this before or has any
>> other ideas.
>
> Hi Richard
>   I was never able to test the SPI support in AVR32UC3A, except for
> adding LEDs to the pins to see if the signals looked OK. The SD card
> is on SPI, so the low-level code works OK, but the Lua interface and
> whether it works or not is to be seen
>   I dunno about the UC3B - do you have an SD card on your board and
> does it work?
>
>      M
>
>   Sorry I can't be more
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
>

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Richard Graham Richard Graham
Reply | Threaded
Open this post in threaded view
|

Re: SPI on AVR32UC3

Hi,

I have noticed a couple of things while trying to debug my SPI problem.

I am actually seeing some activity on the data return line, 8 pulses
infact, the length of which does depend on the SPI clock I set. But
nothing else on the clock or MOSI lines.

Another thing I am curious about is the number of SPI ports as defined
in the cpu_xxxx.h files. If I am reading the data sheet correctly all
the UC3 devices I have looked at have just one or two physical SPI ports
and some number of chip selects available. This number is what is in the
cpu header files. Is this right?

--
Richard


On 05/22/2014 11:31 AM, Richard Graham wrote:

> Hi,
>
> I don't an SD card or extra memory, basically just a UC3B and a single
> DDS chip on the SPI bus.
>
> --
> Richard
>
>
> On 05/22/2014 11:04 AM, Martin Guy wrote:
>> On 22/05/2014, Richard Graham <[hidden email]> wrote:
>>> It seems I am having problems with communications over SPI with my
>>> board. I'm not getting any error messages but basically nothing happens,
>>> no SPI clock signal or data. I also noticed I can't toggle the CS line
>>> with spi.sson.
>>>
>>> I have done some basic checks such as that the SPI pins setup correctly
>>> in my board config, but I'm out of ideas at the moment of further things
>>> to check. I was wondering if anyone had seen this before or has any
>>> other ideas.
>>
>> Hi Richard
>>   I was never able to test the SPI support in AVR32UC3A, except for
>> adding LEDs to the pins to see if the signals looked OK. The SD card
>> is on SPI, so the low-level code works OK, but the Lua interface and
>> whether it works or not is to be seen
>>   I dunno about the UC3B - do you have an SD card on your board and
>> does it work?
>>
>>      M
>>
>>   Sorry I can't be more
>> _______________________________________________
>> eLua-dev mailing list
>> [hidden email]
>> https://lists.berlios.de/mailman/listinfo/elua-dev
>>
>
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
>

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Martin Guy Martin Guy
Reply | Threaded
Open this post in threaded view
|

Re: SPI on AVR32UC3

On 23/05/2014, Richard Graham <[hidden email]> wrote:
> Another thing I am curious about is the number of SPI ports as defined
> in the cpu_xxxx.h files. If I am reading the data sheet correctly all
> the UC3 devices I have looked at have just one or two physical SPI ports
> and some number of chip selects available. This number is what is in the
> cpu header files. Is this right?

Er, which define in which header file? A .h in elua or under
/usr/include/avr32/ ?

   M
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Richard Graham Richard Graham
Reply | Threaded
Open this post in threaded view
|

Re: SPI on AVR32UC3

The header files I am talking about are in
elua/src/platform/avr32/cpu_at32uc3*.h

I don't know if this is related to the problem but I am not sure how
elua defines the difference between the number of physical SPI ports and
hardware chip selects.

If there is indeed a problem with the higher level elua SPI code I was
wondering if someone could direct me to where this higher level code
starts and the lower level code begins.

Also, if by chance someone has an AVR32 based board and can easily check
with a scope that the clock and data lines do something when called from
lua that would be great.

Thanks!
--
Richard


On 05/23/2014 06:23 AM, Martin Guy wrote:

> On 23/05/2014, Richard Graham <[hidden email]> wrote:
>> Another thing I am curious about is the number of SPI ports as defined
>> in the cpu_xxxx.h files. If I am reading the data sheet correctly all
>> the UC3 devices I have looked at have just one or two physical SPI ports
>> and some number of chip selects available. This number is what is in the
>> cpu header files. Is this right?
>
> Er, which define in which header file? A .h in elua or under
> /usr/include/avr32/ ?
>
>    M
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
>

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Tony-12 Tony-12
Reply | Threaded
Open this post in threaded view
|

Re: SPI on AVR32UC3

A question for the AVR32 users:
Is anyone interested in a Atmel UC3-A3 XPLAINED eval kit?  I have one that I'm not likely to use and I would be happy to send it to someone who will use.

http://www.atmel.com/tools/uc3-a3xplained.aspx

--Tony


On Fri, May 23, 2014 at 9:56 AM, Richard Graham <[hidden email]> wrote:
The header files I am talking about are in
elua/src/platform/avr32/cpu_at32uc3*.h

I don't know if this is related to the problem but I am not sure how
elua defines the difference between the number of physical SPI ports and
hardware chip selects.

If there is indeed a problem with the higher level elua SPI code I was
wondering if someone could direct me to where this higher level code
starts and the lower level code begins.

Also, if by chance someone has an AVR32 based board and can easily check
with a scope that the clock and data lines do something when called from
lua that would be great.

Thanks!
--
Richard


On 05/23/2014 06:23 AM, Martin Guy wrote:
> On 23/05/2014, Richard Graham <[hidden email]> wrote:
>> Another thing I am curious about is the number of SPI ports as defined
>> in the cpu_xxxx.h files. If I am reading the data sheet correctly all
>> the UC3 devices I have looked at have just one or two physical SPI ports
>> and some number of chip selects available. This number is what is in the
>> cpu header files. Is this right?
>
> Er, which define in which header file? A .h in elua or under
> /usr/include/avr32/ ?
>
>    M
> _______________________________________________
> eLua-dev mailing list
> [hidden email]
> https://lists.berlios.de/mailman/listinfo/elua-dev
>

_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev


_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev
Martin Guy Martin Guy
Reply | Threaded
Open this post in threaded view
|

Re: SPI on AVR32UC3

In reply to this post by Richard Graham
On 23/05/2014, Richard Graham <[hidden email]> wrote:
> The header files I am talking about are in
> elua/src/platform/avr32/cpu_at32uc3*.h
>
> I don't know if this is related to the problem but I am not sure how
> elua defines the difference between the number of physical SPI ports and
> hardware chip selects.

Each SPI port has 4 chip select lines whereas NUM_SPI is for the total
number of SPI channels.  The "there are 4 CS lines on eacho SPI port"
seems to be be global knowledge not encoded in any defines, so you'll
see in the code stuff like

static const gpio_map_t spi_pins =
{
  // SPI0
  { BOARD_SPI0_SCK_PIN, BOARD_SPI0_SCK_PIN_FUNCTION },
  { BOARD_SPI0_MISO_PIN, BOARD_SPI0_MISO_PIN_FUNCTION },
  { BOARD_SPI0_MOSI_PIN, BOARD_SPI0_MOSI_PIN_FUNCTION },
  { BOARD_SPI0_CS_PIN, BOARD_SPI0_CS_PIN_FUNCTION },

  // SPI1
#if NUM_SPI > 4
  { BOARD_SPI1_SCK_PIN, BOARD_SPI1_SCK_PIN_FUNCTION },
  { BOARD_SPI1_MISO_PIN, BOARD_SPI1_MISO_PIN_FUNCTION },
  { BOARD_SPI1_MOSI_PIN, BOARD_SPI1_MOSI_PIN_FUNCTION },
  { BOARD_SPI1_CS_PIN, BOARD_SPI1_CS_PIN_FUNCTION },
#endif
};

and

// Initialise the specified SPI controller (== id / 4) as a master
static void spi_init_master( unsigned controller )
{

NUM_SPI only seems to be used to put an upper limit on the SPI device
ID, and to check in #defines whether NUM_SPI > 0 to include SPI code
at all, and whether NUM_SPI >= 4 to see if it should define one or two
controllers, basically.

The AT32UC3 also has a mode where the 4 chip select lines are decoded
to select one of 15 (16?) peripherals, but eLua doesn't use that mode
at present.

As to why the EVK1100/Mizar32 .h files say "#define NUM_SPI 6" I can
only wonder.
It's not to leave two for the SD card, which is on SPI1 CS0, and SPI1
CS2 is even present on the Mizar32's connectors, so I would have
thought it should be at least 7 if not 8 for the UC3A.  FOr the UC3B I
see it is 4, which should be correct for the one SPI controller it has
and its 4 chip select lines.

Unfortunately I can't run any tests as I don't have any of these
boards any more.

   M
_______________________________________________
eLua-dev mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/elua-dev