SPI send data
Posted: Fri Jul 03, 2020 1:23 pm
Hi, after struggling some days with sending bytes from Arduino/ATMEGA328P to a L6470PD steppingmotor driver chip, using the SPI-master component, please your tips how to sort out this function.
An Arduino.INO example for this L6470 chip does work on the same hardware configuration, so this is good.
Want to transfer it to Flowcode to integrate the other I/O logic, but need to get the steppingmotor functions working good first.
Just want to send a few command-bytes for initalisation, followed by Motor-RUN command bytes (also 3 separate bytes) each second.
At our digital Oscilloscope with SPI view, just get a lot of unknown information on screen when doing this in Flowcode, while the Arduino.INO example works fine with steady readable signal views.
How do i transfer 3 or 4 single bytes after eachother, like this initialisation example:
SPI-MASTER1: Enable CS()
SPI-Master1: Sendchar (0x00)
SPI-MASTER1: Disable CS()
SPI-MASTER1: Enable CS()
SPI-Master1: Sendchar (0x18)
SPI-MASTER1: Disable CS()
SPI-MASTER1: Enable CS()
SPI-Master1: Sendchar (0xA0)
SPI-MASTER1: Disable CS()
SPI-MASTER1: Enable CS()
SPI-Master1: Sendchar (0x06)
SPI-MASTER1: Disable CS()
then followed by a while-loop with 1 second delay at the end :
SPI-MASTER1: Enable CS()
SPI-Master1: Sendchar (0x40)
SPI-MASTER1: Disable CS()
SPI-MASTER1: Enable CS()
SPI-Master1: Sendchar (0x00)
SPI-MASTER1: Disable CS()
SPI-MASTER1: Enable CS()
SPI-Master1: Sendchar (0xFF)
SPI-MASTER1: Disable CS()
delay (1000 ms)
I have used SendChar, or is another command better, like SPI-MASTER1: Transaction, SendString or SendByteArray, and how to use it?
Ar the Enable_CS and Disable-CS needed around each byte, or can it be a single Enable/Disable at top and bottom?
What are the best BUS-settings and Prescale options?
Any other tips, or maybe any SPI-component update needed?
Is any Flowcode SPI example available for this kind (or lookalike) of L6470 chips, or a simular other application i can adjust to it?
thanks and regards,
Luuk Aalders
An Arduino.INO example for this L6470 chip does work on the same hardware configuration, so this is good.
Want to transfer it to Flowcode to integrate the other I/O logic, but need to get the steppingmotor functions working good first.
Just want to send a few command-bytes for initalisation, followed by Motor-RUN command bytes (also 3 separate bytes) each second.
At our digital Oscilloscope with SPI view, just get a lot of unknown information on screen when doing this in Flowcode, while the Arduino.INO example works fine with steady readable signal views.
How do i transfer 3 or 4 single bytes after eachother, like this initialisation example:
SPI-MASTER1: Enable CS()
SPI-Master1: Sendchar (0x00)
SPI-MASTER1: Disable CS()
SPI-MASTER1: Enable CS()
SPI-Master1: Sendchar (0x18)
SPI-MASTER1: Disable CS()
SPI-MASTER1: Enable CS()
SPI-Master1: Sendchar (0xA0)
SPI-MASTER1: Disable CS()
SPI-MASTER1: Enable CS()
SPI-Master1: Sendchar (0x06)
SPI-MASTER1: Disable CS()
then followed by a while-loop with 1 second delay at the end :
SPI-MASTER1: Enable CS()
SPI-Master1: Sendchar (0x40)
SPI-MASTER1: Disable CS()
SPI-MASTER1: Enable CS()
SPI-Master1: Sendchar (0x00)
SPI-MASTER1: Disable CS()
SPI-MASTER1: Enable CS()
SPI-Master1: Sendchar (0xFF)
SPI-MASTER1: Disable CS()
delay (1000 ms)
I have used SendChar, or is another command better, like SPI-MASTER1: Transaction, SendString or SendByteArray, and how to use it?
Ar the Enable_CS and Disable-CS needed around each byte, or can it be a single Enable/Disable at top and bottom?
What are the best BUS-settings and Prescale options?
Any other tips, or maybe any SPI-component update needed?
Is any Flowcode SPI example available for this kind (or lookalike) of L6470 chips, or a simular other application i can adjust to it?
thanks and regards,
Luuk Aalders