在树莓派OK LED SOS莫尔斯code - 不工作 [英] SOS morse code on Raspberry Pi OK LED - not working

查看:198
本文介绍了在树莓派OK LED SOS莫尔斯code - 不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在下面的烘焙丕 ,建设装配的ARMv6一个非常基本的操作系统能够为树莓派。我们从转动确定通过GPIO控制器LED上,以使它眨眼使用系统计时器,以根据存储在一个再由位图psented $ P $图案使它闪烁消失。 INT 值。这最后一种解决方案不会出现工作。起初我以为我一定是不正确地解决了这个问题,但无论我多么检查我与功能的解决方案的这里规定,我不能看到一个显著差异。

I'm following Baking Pi, building a very basic operating system in ARMv6 assembly for the Raspberry Pi. We've gone from turning the OK LED on via the GPIO controller, to making it blink using the system timer, to making it blink according to a pattern represented by a bitmap stored in a .int value. This last solution doesn't appear to work. At first I thought I must have solved the problem incorrectly, but no matter how much I check my solution with the functional solution provided here, I can't see a significant difference.

我屈服了,最后下载了实际的解决方案,它编译并安装它在我的皮。它具有相同的破碎的行为,我自己的解决方案。也就是说,LED指示灯亮起,但仅仅停留在。我认为程序已经崩溃,或指令是不是做家教要它做什么。

I caved and finally downloaded the actual solution, compiled it and installed it on my Pi. It exhibits the same broken behaviour as my own solution. That is, the LED turns on, but just stays on. I assume the program has crashed, or the and instruction isn't doing what the tutor wants it to do.

喜欢这样的解决方案:

bitmap   .req r4
seq      .req r5
ldr bitmap,=pattern
ldr bitmap,[bitmap]
mov seq,#0         /* start at the zeroth bit */

loop$:
  mov r0,#16       /* set gpio pin 16: OK LED */
  mov r1,#1        /* bitmask starts with a 1 */
  lsl r1,seq       /* shift to the correct bit */
  and r1,bitmap    /* mask according to the pattern */
  bl SetGpio       /* set the LED state (r1 zero = off, non-zero = on) */
  bl Wait          /* wait for a short interval */
  add seq,#1       /* increment the sequence counter */
  and seq,#0b11111 /* reset seq to 0 if >= 32 */
  b loop$          /* loop forever */

.section .data

.align 2
pattern:
  .int 0b11111111101010100010001000101010

现在我知道了等待 SetGpio 功能正常工作,因为previous教训只是眨了眨眼的每隔一段时间,我被 EOR 做'上循环$的每次迭代ING 1 1或0或关闭LED 。这里介绍的只是新显著的概念是要重新present的SOS图案位图。我很舒服的位图和位掩码,正如我在高级语言经常使用,所以我认为逻辑是好的,但还有别的东西不对劲,可能与如何使用 .INT 被存储/填充?

Now I know the Wait and SetGpio functions work correctly, since the previous lesson just blinked the LED on and off at set intervals, which I was doing by EOR'ing a 1 or 0 with 1 on each iteration of loop$. The only new significant concept introduced here is the bitmap to represent the SOS pattern. I'm comfortable with bitmaps and bitmasks, as I use them regularly in higher level languages, so I think the logic is ok, but there's something else amiss, maybe with how the .int is being stored/padded?

做任何事情跳出来为自己的错误与上面的逻辑是什么? SetGpio 的合同是:

Does anything jump out as being wrong with the above logic? The contract of SetGpio is:


  • r0的必须设置的GPIO引脚数,在此情况下16

  • R1必须设置为非零如果LED应该是,否则为零将其关闭

  • 的返回值不是显著

等待函数如下:

/* Sleep for 500 milliseconds */
Wait:
  push {lr}
  ldr r0,=500
  bl SleepForDelay
  pop {pc}

编辑|事实上,在这两个煤矿和导师的解决方案beavhiour是:

EDIT | Actually, the beavhiour in both mine and the tutor's solution is:


  1. LED亮起一个短暂的时间(一个点,我猜)

  2. LED追溯到再次关闭

  3. LED灯亮起,永远停留在

我居然想到了第一次闪烁只是引导程序操作,但如果我在我的程序年初引进故意撞车时,LED永远不会到来的都没有。

I actually thought the first blink was just the bootloader operating, but if I introduce a deliberate crash early in my program, the LED never comes on at all.

推荐答案

原来这无关与code和实际上的配置上树莓派设置。

Turns out this had nothing to do with the code and was actually a configuration setting on the Raspberry Pi.

/config.txt需要 kernel_old = 1

/config.txt needed kernel_old=1.

这篇关于在树莓派OK LED SOS莫尔斯code - 不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆