What are the PUART FIFO Rx interrupt threshold settings?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

The PUART examples use:

// set watermark to 15 byte - will interrupt after 15bytes have been received.
P_UART_WATER_MARK_RX_LEVEL (1);

[Note: trying to paste code into this forum seems quite difficult. I kept getting tables inside a pre, and the editor doesn't seem to deal with them gracefully, and I really didn't want a table anyhow.]

The macro expands to writing a register at 0x003604ac.  I can't find any documentation explaining what the legal values to pass to the macro (or write to this regster) are. Can someone please either explain the settings, or point me to documentation that does?

I want to get the Rx interrupt *much* earlier, rather than when there's only one byte of FIFO left.  Since the SIPs apparently can't actually support flow control (based on other forum postings), the application I'm developing for a client is running with no flow control, and I'm having trouble with losing Rx data when the BLE stack is doing stuff, apparently with interrupts disabled for way more than one Rx character time.

Since the hardware FIFO is 16 bytes, and setting the watermark to a level of 16 bytes is done using a value of 1, I had hoped that maybe the value for an n-byte watermark was 16-n, but my experiments with that haven't been successful. Passing 12 to the macro resulted in not receiving any characters at all.

Is there any *real* documentation for the PUART, that I've somehow overlooked? The doxygen stuff is spectacularly unhelpful about any of the macros, and not much better about the functions. IMHO this seems like one of the worst-documented chips ever, but maybe the documentation is just hard to find.

Thanks!

Eric

0 Likes
1 Solution
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

embeddedmasters can help you with the cut and paste problem into Eclipse.

The online documentation is all we provide. Note that many lower level APIs are intentionally hidden and not intended to be publicly exposed for reasons outside the scope of this discussion.

// The following will set the watermark value to 1 byte and trigger an interrupt on every byte received.

P_UART_WATER_MARK_RX_LEVEL (1);

There are a few threads on this subject you should take a look at, both contain sample code:

UART Routines

UART does not receive

There are many more PUART related threads here as well: WICED Smart Forums

vik86WICED Smart Forums

View solution in original post

3 Replies
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

embeddedmasters can help you with the cut and paste problem into Eclipse.

The online documentation is all we provide. Note that many lower level APIs are intentionally hidden and not intended to be publicly exposed for reasons outside the scope of this discussion.

// The following will set the watermark value to 1 byte and trigger an interrupt on every byte received.

P_UART_WATER_MARK_RX_LEVEL (1);

There are a few threads on this subject you should take a look at, both contain sample code:

UART Routines

UART does not receive

There are many more PUART related threads here as well: WICED Smart Forums

vik86WICED Smart Forums

Anonymous
Not applicable

Thanks for the quick reply!

I'm not having any cut and paste problems with Eclipse. I've used Eclipse for years, and aside from still being absurdly slow, it mostly works OK. My comment was about trouble pasting code into this forum. There may well be some easy way to do it, but it's not readily apparent.

Apparently the comments in the PUART code I copied were wrong, because it was already setting the value to 1, even though the comment said that it would interrupt after 15 bytes received.  I'll have to experiment with it further to figure out what's going wrong.

I've worked for a semiconductor company that made SoCs, so I well understand many of the reasons why you abstract away nearly all of the low-level stuff and details of the protocol stack.  However, I think in some areas, such as the PUART, this has gone too far by not documenting something that customers are actually supposed to use.

Thanks especially for the link to the "UART Routines" thread. My next question was going to be how to use the transmit callback, another essentially undocumented part of the PUART API, and it's actually covered pretty well in that thread.

Best regards,

Eric

0 Likes

I see.  You are correct, cutting and pasting directly from Eclipse into the forums is tricky as the system adds alot of formatting that is uneeded.

What I normally do is cut and paste from Eclipse, into a text editor like Windows Notepad, then cut and paste from it into the form.

Below is an example I just pulled from the pwm_tones app. Extra step, but works great.

const UINT8 tones_gatt_database[]=
{
    // Handle 0x01: GATT service
    // Service change characteristic is optional and is not present
    PRIMARY_SERVICE_UUID16 (0x0001, UUID_SERVICE_GATT),

    // Handle 0x14: GAP service
    // Device Name and Appearance are mandatory characteristics.  Peripheral
    // Privacy Flag only required if privacy feature is supported.  Reconnection
    // Address is optional and only when privacy feature is supported.
    // Peripheral Preferred Connection Parameters characteristic is optional
    // and not present.
    PRIMARY_SERVICE_UUID16 (0x0014, UUID_SERVICE_GAP),

    // Handle 0x15: characteristic Device Name, handle 0x16 characteristic value.
    // Any 16 byte string can be used to identify the sensor.  Just need to
    // replace the "Tones" string below.
    CHARACTERISTIC_UUID16 (0x0015, 0x0016, UUID_CHARACTERISTIC_DEVICE_NAME,
                                           LEGATTDB_CHAR_PROP_READ, LEGATTDB_PERM_READABLE, 16),
       'P','W','M',' ','T','o','n','e','s',0x00,0x00,0x00,0x00,0x00,0x00,0x00,

Note that the UART Routines thread is the definitive source for all PUART threads.

Welcome aboard.

0 Likes