[En-Nut-Discussion] SPI Documentation

Nikolas Becker N.Becker at pemtec.de
Fri Apr 3 16:18:48 CEST 2020


Hi Uwe,

First: thanks! I will try that. 

Sorry, I didn't know there was something missing from the other issue! I summarize:

- All my mail addresses are not able to receive zip- or exe-files, so none of your compiled qnutconf-version reached me, sadly and I was not able to try it. Is there some kind of webspace to upload it to?

- The version of Thiago gives the same already known issue: the makedefs can not be found:

16:16:04: Creating Makefiles for  in D:/dev/trunk/Ethernut/ethernut_2020_03_30/ethernut50f/nutbld
16:16:04: Creating header files in D:/dev/trunk/Ethernut/ethernut_2020_03_30/ethernut50f/nutbld
16:16:04: ----- Running 'make clean' -----
16:16:05: makefile:38: D:/dev/trunk/Ethernut/ethernut_2020_03_30/nut/Makedefs.: No such file or directory
16:16:05: makefile:51: D:/dev/trunk/Ethernut/ethernut_2020_03_30/nut/Makerules.: No such file or directory
16:16:05: make[1]: *** No rule to make target `D:/dev/trunk/Ethernut/ethernut_2020_03_30/nut/Makerules.'.  Stop.
16:16:05: make: *** [clean] Error 2

- By running nutconfigure from the console, Thiago found that I would build my librarys for the wrong platform (AVR). But since I already chose the platform in nutconfigure with the -m command as arm-gcc, I don't know where I can change any other parameters so the right platform is set?

Best regards,
   Nikolas


-----Ursprüngliche Nachricht-----
Von: en-nut-discussion-bounces at egnite.de [mailto:en-nut-discussion-bounces at egnite.de] Im Auftrag von bon at elektron.ikp.physik.tu-darmstadt.de
Gesendet: Freitag, 3. April 2020 15:35
An: Ethernut User Chat (English) <en-nut-discussion at egnite.de>
Betreff: Re: [En-Nut-Discussion] SPI Documentation

Nikolas Becker writes:
> Hi guys,
> 
> I'm working now with my ethernut5 and the TCP/IP-functionality is just so nice working out of the box, very happy with it.
> 
> Now I need to read data from several ADCs via SPI. And here comes my problem: where can I find some documentation for the SPI device driver? 
> 
> In the Nut/OS Software manual
> http://www.ethernut.de/pdf/enswm28e.pdf
>  there are some lines regarding SPI on page 45, suggesting the use of NutRegisterSpiDevice(), but not much more.
> 
> In the Nut/OS wiki, I found this article:
> http://www.ethernut.de/nutwiki/index.php/Documents/NTN-6_SPI
> Which gives some examples for using the SPI and are very similar to the usage here:
> http://www.ethernut.de/nutwiki/index.php/SPI
> So I tried this:
> 
> #define NUMBER_OF_CHANNELS				4
> #define ADC_CONV_PIN 					3
> #define ADC_CONV_PORT 					NUTGPIO_PORTB
> 
> NUTSPINODE adc_node = {&spiBus0At91, NULL, 45158500, 0, 
> (NUMBER_OF_CHANNELS*32), 0};
Hello Nikolas,

the initialisation seem fishy. In 2020, is good habit to use modern C struct initialization like:

NUTSPINODE spi_node = {
    .node_bus  =  &DEF_SPIBUS,
    .node_stat = NULL,
    .node_rate = 1000000,
    .node_mode = SPI_MODE_0,
    .node_bits = 8,
    .node_cs = 0,
    .node_dcb = NULL,
};

.node_bits seems not good in your code. Most SPI IP transfers in units of 8 bits. But even if the IP can do more, Ethernut device driver must support it and I am not sure about Atmel. I use Stm32.

Otherwise, I am still missing exact error output from the problem you had last week. We help you, you help us...

Bye
-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 1623569 ------- Fax. 06151 1623305 --------- _______________________________________________
http://lists.egnite.de/mailman/listinfo/en-nut-discussion


More information about the En-Nut-Discussion mailing list