Skip to content

Implemented UART in accordance with the API definition in softuart.h to allow the example code to access printf() functionality#18

Open
RacingTornado wants to merge 1 commit intomithro:linux-descriptorsfrom
RacingTornado:fast_uart_try3
Open

Implemented UART in accordance with the API definition in softuart.h to allow the example code to access printf() functionality#18
RacingTornado wants to merge 1 commit intomithro:linux-descriptorsfrom
RacingTornado:fast_uart_try3

Conversation

@RacingTornado
Copy link

sudo minicom -H -w fastuart

You should have the parameters of fastuart set to 115200. You should see the values on the terminal.

The PA2 pin must be connected to the rx pin on the serial adaptor. In this situation , the ground must be the same also. Else you may get receiving errors.

The idea is to use this for debugging purposes. The baud rates is set to 115200 by setting the delay values.

Another important fact is that the console must be first opened up before loading the firmware onto the FX2. This is required for getting a lock on the start and the stop bits since there is no line break attached between the 2 bytes.

Code has been cleaned up and the firmware in the examples directory is extremely small(less than 5-6 lines)
Assembly has been extensively commented.
I would like to merge this with the linux-descriptors branch since this is what I used as a base

@RacingTornado RacingTornado changed the title Created a UART API definition in softuart.h to allow the example code to access printf() and scanf() functionality Implemented UART in keeping with the API definition in softuart.h to allow the example code to access printf() and scanf() functionality Jun 24, 2016
@RacingTornado RacingTornado changed the title Implemented UART in keeping with the API definition in softuart.h to allow the example code to access printf() and scanf() functionality Implemented UART in accordance with the API definition in softuart.h to allow the example code to access printf() and scanf() functionality Jun 24, 2016
@RacingTornado RacingTornado changed the title Implemented UART in accordance with the API definition in softuart.h to allow the example code to access printf() and scanf() functionality Implemented UART in accordance with the API definition in softuart.h to allow the example code to access printf() functionality Jun 24, 2016
@mithro
Copy link
Owner

mithro commented Jun 24, 2016

This is starting down the right path, but there are a couple of big things which need to change.

As I described in my email, there should be a function / macro something like CREATE_FAST_UART(<uart name>, <tx pin>). Calling this should generate a bunch of functions with names like uart0_init, uart0_rx etc (assuming <uart name> was set to uart0).

This allows you to create two uarts on two different pins which can be used at the same time.

Your comments about the API are misleading too. It very much does matter what you return for the queue count.

When commenting your ASM, you should align things like cycle counts above each other.

@mithro
Copy link
Owner

mithro commented Jun 24, 2016

Please write your setup/testing instructions in the form of valid shell commands too.

#include <stdio.h>
#include <uart/api.h>

//Used for setting the baud rate.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't define things you are not using at the moment.

@RacingTornado
Copy link
Author

RacingTornado commented Jun 24, 2016

This allows you to create two uarts on two different pins which can be used at the same time

I am a little confused as to how you plan to achieve this.
#define something(name,func) name##some"()"
something(hello,1)
From what locations so you plan to call this. I am not sure I understand this feature completely. Wont it just be better to have a function which sets the pin in api.h and implement this since the function fast_uart blocks anyway. I dont seem to understand "same_time" means in this context

@RacingTornado
Copy link
Author

RacingTornado commented Jun 25, 2016

When commenting your ASM, you should align things like cycle counts above each other.

This is kind of hard but I have tried doing it

@mithro
Copy link
Owner

mithro commented Jun 25, 2016


BOOL uartX_set_baud(enum uart_baud rate)
{
switch(rate)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually didn't mean for you to implement all the baud rates, just to return an error when the baud rate was not BAUD_115200. However, as you have already done it now we can leave it here.

@RacingTornado RacingTornado force-pushed the fast_uart_try3 branch 6 times, most recently from 4f4d855 to 5076805 Compare June 25, 2016 13:14
@@ -0,0 +1,15 @@
#!/bin/bash -e
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This download script should probably be shared between all examples. Can you move it into the examples directory and send it as a separate pull request.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could then have it as part of the common Makefile..

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants