SPI SCK pin does not output anything

Post Reply
ywtom3
Posts: 4
Joined: Mon Nov 25, 2019 7:03 pm
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

SPI SCK pin does not output anything

Unread post by ywtom3 » Mon Nov 25, 2019 7:21 pm

Hello everyone,
first time posting here. I am having a problem with the SPI on my odroid n2 with a ubuntu 18.04.
I am trying to communicate with an external chip (PS09) using SPI, so I follow the SPI setup procedure listed on the odroid wiki page.
I successfully setup the SPI and tested with the loopback test, but when I try to perform the same test at the very bottom of the webpage (the one with oscilloscope picture),
there were no clock signal at all.
I later tried it on a logic analyzer, there were no clock signal also and the MOSI signal went crazy for some reason.
Can anyone provide some insight?[imgur][/imgur]

User avatar
odroid
Site Admin
Posts: 32690
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 212 times
Been thanked: 364 times
Contact:

Re: SPI SCK pin does not output anything

Unread post by odroid » Tue Nov 26, 2019 10:01 am

Can you show me results from the following commands? Both must be "okay".

Code: Select all

fdtget /media/boot/meson64_odroidn2.dtb /soc/cbus@ffd00000/spi@13000 status
fdtget /media/boot/meson64_odroidn2.dtb /soc/cbus@ffd00000/spi@13000/spidev@0 status
And fix the missing image link.

ywtom3
Posts: 4
Joined: Mon Nov 25, 2019 7:03 pm
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

Re: SPI SCK pin does not output anything

Unread post by ywtom3 » Tue Nov 26, 2019 12:21 pm

Thanks for the reply,
here is the status of the spidev
spi_status.png
spi_status.png (23.07 KiB) Viewed 178 times
This one is the missing picture in my first post.
I am trying to recreate the image shown at the "Various Test" section on the odroid wiki page.
Couldn't get it working on the oscilloscope so I used the logic analyzer instead.
I am trying to understand why the clock signal did not show up and why the MOSI got so much random signal when I only run the spidev_test twice in this 5 sec span.
(the two enable toggle showed that I ran it twice)
SPI_NO_CLOCK_SIGNAL.PNG
SPI_NO_CLOCK_SIGNAL.PNG (91.37 KiB) Viewed 178 times
This one I shortened the sample period and zoomed in where the enable was toggled, still did not see the clock signal
logic_analyzer_no_clock_signal.PNG
logic_analyzer_no_clock_signal.PNG (92.09 KiB) Viewed 178 times

Perhaps my wiring is wrong?

User avatar
odroid
Site Admin
Posts: 32690
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 212 times
Been thanked: 364 times
Contact:

Re: SPI SCK pin does not output anything

Unread post by odroid » Tue Nov 26, 2019 2:27 pm

What happens if you don't connect the external SPI device?
Please check the waveform with the loop back connection to narrow down root causes.

ywtom3
Posts: 4
Joined: Mon Nov 25, 2019 7:03 pm
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

Re: SPI SCK pin does not output anything

Unread post by ywtom3 » Tue Nov 26, 2019 6:50 pm

So I found the reason why this is not working.
The jumper wire I used to connect to the GND was broken so the waveform was bad.
Such a stupid mistake.

User avatar
odroid
Site Admin
Posts: 32690
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 212 times
Been thanked: 364 times
Contact:

Re: SPI SCK pin does not output anything

Unread post by odroid » Wed Nov 27, 2019 9:57 am

Glad to hear that you found a root cause.

BTW, can you tell me what you are going to make with the PS09 Resistance-to-Digital Converter?

ywtom3
Posts: 4
Joined: Mon Nov 25, 2019 7:03 pm
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

Re: SPI SCK pin does not output anything

Unread post by ywtom3 » Tue Dec 03, 2019 7:27 pm

Oops sorry for the late reply,
This is a project that is measuring pressure change as I am swapping the MCU to a single board computer so I can make it portable.
Also I have a question about hardware interrupt, is it possible to enable hardware interrupt on the MISO pin?
The reason why I want to do this is because PS09 has a slightly different SPI communication compare other devices

User avatar
odroid
Site Admin
Posts: 32690
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 212 times
Been thanked: 364 times
Contact:

Re: SPI SCK pin does not output anything

Unread post by odroid » Wed Dec 04, 2019 9:57 am

No problem.

Connect the MISO output from the sensor to a spare GPIO input pin on the 40pin header via extra another wire and implement an IRQ handler in your software.
https://wiki.odroid.com/odroid-n2/appli ... e/gpio/irq

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 0 guests